Fix missing error for accessing type-only export * member through namespace (#57176)

This commit is contained in:
Andrew Branch
2024-01-30 17:04:13 -08:00
committed by GitHub
parent d21b1d271f
commit d2d3b24737
11 changed files with 223 additions and 0 deletions

View File

@@ -14914,6 +14914,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (type.flags & TypeFlags.Object) {
const resolved = resolveStructuredTypeMembers(type as ObjectType);
const symbol = resolved.members.get(name);
if (symbol && !includeTypeOnlyMembers && type.symbol?.flags & SymbolFlags.ValueModule && getSymbolLinks(type.symbol).typeOnlyExportStarMap?.has(name)) {
// If this is the type of a module, `resolved.members.get(name)` might have effectively skipped over
// an `export type * from './foo'`, leaving `symbolIsValue` unable to see that the symbol is being
// viewed through a type-only export.
return undefined;
}
if (symbol && symbolIsValue(symbol, includeTypeOnlyMembers)) {
return symbol;
}