Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scope-manager): support TS4.5 import/export specifier kind (#4234)
- Loading branch information
1 parent
8377e6e
commit 833f822
Showing
22 changed files
with
344 additions
and
41 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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
//// @sourceType = module | ||
|
||
const T = 1; // unreferenced | ||
type T = 1; | ||
export default T; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//// @sourceType = module | ||
|
||
const T = 1; // unreferenced | ||
type T = 1; | ||
export { type T }; |
75 changes: 75 additions & 0 deletions
75
packages/scope-manager/tests/fixtures/export/type-inline.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,75 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`export type-inline 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
ImplicitGlobalConstTypeVariable, | ||
Variable$2 { | ||
defs: Array [ | ||
VariableDefinition$1 { | ||
name: Identifier<"T">, | ||
node: VariableDeclarator$1, | ||
}, | ||
TypeDefinition$2 { | ||
name: Identifier<"T">, | ||
node: TSTypeAliasDeclaration$2, | ||
}, | ||
], | ||
name: "T", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"T">, | ||
init: true, | ||
isRead: false, | ||
isTypeReference: false, | ||
isValueReference: true, | ||
isWrite: true, | ||
resolved: Variable$2, | ||
writeExpr: Literal$3, | ||
}, | ||
Reference$2 { | ||
identifier: Identifier<"T">, | ||
isRead: true, | ||
isTypeReference: true, | ||
isValueReference: false, | ||
isWrite: false, | ||
resolved: Variable$2, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$4, | ||
isStrict: false, | ||
references: Array [], | ||
set: Map { | ||
"const" => ImplicitGlobalConstTypeVariable, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
ImplicitGlobalConstTypeVariable, | ||
], | ||
}, | ||
ModuleScope$2 { | ||
block: Program$4, | ||
isStrict: true, | ||
references: Array [ | ||
Reference$1, | ||
Reference$2, | ||
], | ||
set: Map { | ||
"T" => Variable$2, | ||
}, | ||
type: "module", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$2, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
5 changes: 5 additions & 0 deletions
5
packages/scope-manager/tests/fixtures/import/type-inline-value.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 @@ | ||
//// @sourceType = module | ||
|
||
import { type foo } from 'foo'; | ||
|
||
type T = typeof foo; |
74 changes: 74 additions & 0 deletions
74
packages/scope-manager/tests/fixtures/import/type-inline-value.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,74 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`import type-inline-value 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
ImplicitGlobalConstTypeVariable, | ||
Variable$2 { | ||
defs: Array [ | ||
ImportBindingDefinition$1 { | ||
name: Identifier<"foo">, | ||
node: ImportSpecifier$1, | ||
}, | ||
], | ||
name: "foo", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"foo">, | ||
isRead: true, | ||
isTypeReference: false, | ||
isValueReference: true, | ||
isWrite: false, | ||
resolved: Variable$2, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$3 { | ||
defs: Array [ | ||
TypeDefinition$2 { | ||
name: Identifier<"T">, | ||
node: TSTypeAliasDeclaration$2, | ||
}, | ||
], | ||
name: "T", | ||
references: Array [], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$3, | ||
isStrict: false, | ||
references: Array [], | ||
set: Map { | ||
"const" => ImplicitGlobalConstTypeVariable, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
ImplicitGlobalConstTypeVariable, | ||
], | ||
}, | ||
ModuleScope$2 { | ||
block: Program$3, | ||
isStrict: true, | ||
references: Array [ | ||
Reference$1, | ||
], | ||
set: Map { | ||
"foo" => Variable$2, | ||
"T" => Variable$3, | ||
}, | ||
type: "module", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$2, | ||
Variable$3, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
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,6 @@ | ||
//// @sourceType = module | ||
|
||
import { type T } from 'foo'; | ||
|
||
type Ref = T; | ||
const unresolved = T; |
Oops, something went wrong.