mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Skip isBlockScopedNameDeclaredBeforeUse error in interface or type declarations
Fixes #35947.
This commit is contained in:
@@ -1418,7 +1418,7 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!!(usage.flags & NodeFlags.JSDoc) || isInTypeQuery(usage)) {
|
||||
if (!!(usage.flags & NodeFlags.JSDoc) || isInTypeQuery(usage) || usageInTypeDeclaration()) {
|
||||
return true;
|
||||
}
|
||||
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
||||
@@ -1432,6 +1432,10 @@ namespace ts {
|
||||
}
|
||||
return false;
|
||||
|
||||
function usageInTypeDeclaration() {
|
||||
return !!findAncestor(usage, node => isInterfaceDeclaration(node) || isTypeAliasDeclaration(node));
|
||||
}
|
||||
|
||||
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration: VariableDeclaration, usage: Node): boolean {
|
||||
switch (declaration.parent.parent.kind) {
|
||||
case SyntaxKind.VariableStatement:
|
||||
|
||||
Reference in New Issue
Block a user