-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(scope-manager): correct analysis of abstract class properties (#2420
- Loading branch information
1 parent
3a7ec9b
commit cd84549
Showing
4 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/scope-manager/tests/fixtures/class/declaration/abstract-property.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type T = 1; | ||
|
||
abstract class Foo { | ||
protected abstract readonly prop: T; | ||
} |
85 changes: 85 additions & 0 deletions
85
packages/scope-manager/tests/fixtures/class/declaration/abstract-property.ts.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`class declaration abstract-property 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
Variable$1 { | ||
defs: Array [ | ||
TypeDefinition$1 { | ||
name: Identifier<"T">, | ||
node: TSTypeAliasDeclaration$1, | ||
}, | ||
], | ||
name: "T", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"T">, | ||
isRead: true, | ||
isTypeReference: true, | ||
isValueReference: false, | ||
isWrite: false, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
ClassNameDefinition$2 { | ||
name: Identifier<"Foo">, | ||
node: ClassDeclaration$2, | ||
}, | ||
], | ||
name: "Foo", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$3 { | ||
defs: Array [ | ||
ClassNameDefinition$3 { | ||
name: Identifier<"Foo">, | ||
node: ClassDeclaration$2, | ||
}, | ||
], | ||
name: "Foo", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$3, | ||
isStrict: false, | ||
references: Array [], | ||
set: Map { | ||
"T" => Variable$1, | ||
"Foo" => Variable$2, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
Variable$1, | ||
Variable$2, | ||
], | ||
}, | ||
ClassScope$2 { | ||
block: ClassDeclaration$2, | ||
isStrict: true, | ||
references: Array [ | ||
Reference$1, | ||
], | ||
set: Map { | ||
"Foo" => Variable$3, | ||
}, | ||
type: "class", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$3, | ||
], | ||
}, | ||
], | ||
} | ||
`; |