mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Skip isBlockScopedNameDeclaredBeforeUse error in interface or type declarations
Fixes #35947.
This commit is contained in:
1 parent
dcc6c9461e
commit
e4babd40e0
5 files changed
+90
-1
No files matched your search
@@ -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