mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 06:17:19 -05:00
Fix reporting an error on block-scope for module
This commit is contained in:
@@ -573,7 +573,16 @@ namespace ts {
|
||||
declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg));
|
||||
return undefined;
|
||||
}
|
||||
if (result.flags & SymbolFlags.BlockScopedVariable) {
|
||||
|
||||
// Only check for block-scoped variable if we are looking for the name with variable meaning
|
||||
// For example,
|
||||
// declare module foo {
|
||||
// interface bar {}
|
||||
// }
|
||||
// let foo/*1*/: foo/*2*/.bar;
|
||||
// The foo at /*1*/ and /*2*/ will share same symbol with two meaning block-scope variable and namespace module.
|
||||
// However, only when we try to resolve name in /*1*/ which is used in variable position, we want to check for block- scoped
|
||||
if (meaning & SymbolFlags.Variable && result.flags & SymbolFlags.BlockScopedVariable) {
|
||||
checkResolvedBlockScopedVariable(result, errorLocation);
|
||||
}
|
||||
}
|
||||
@@ -4256,11 +4265,11 @@ namespace ts {
|
||||
return getInferredType(context, i);
|
||||
}
|
||||
}
|
||||
return t;
|
||||
return t;
|
||||
};
|
||||
|
||||
mapper.context = context;
|
||||
return mapper;
|
||||
return mapper;
|
||||
}
|
||||
|
||||
function identityMapper(type: Type): Type {
|
||||
|
||||
Reference in New Issue
Block a user