Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a345e8
commit 6bf7a89
Showing
26 changed files
with
958 additions
and
9 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
2 changes: 2 additions & 0 deletions
2
packages/scope-manager/tests/fixtures/type-annotation/parameter-array-destructure.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,2 @@ | ||
type T = []; | ||
function foo([a]: T) {} |
91 changes: 91 additions & 0 deletions
91
packages/scope-manager/tests/fixtures/type-annotation/parameter-array-destructure.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,91 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`type-annotation parameter-array-destructure 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">, | ||
isTypeReference: true, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
FunctionNameDefinition$2 { | ||
name: Identifier<"foo">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "foo", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
Variable$3 { | ||
defs: Array [], | ||
name: "arguments", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$4 { | ||
defs: Array [ | ||
ParameterDefinition$3 { | ||
name: Identifier<"a">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "a", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
], | ||
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, | ||
], | ||
}, | ||
FunctionScope$2 { | ||
block: FunctionDeclaration$2, | ||
isStrict: false, | ||
references: Array [ | ||
Reference$1, | ||
], | ||
set: Map { | ||
"arguments" => Variable$3, | ||
"a" => Variable$4, | ||
}, | ||
type: "function", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$3, | ||
Variable$4, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
2 changes: 2 additions & 0 deletions
2
packages/scope-manager/tests/fixtures/type-annotation/parameter-default.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,2 @@ | ||
type T = 1; | ||
function foo(a: T = 1) {} |
100 changes: 100 additions & 0 deletions
100
packages/scope-manager/tests/fixtures/type-annotation/parameter-default.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,100 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`type-annotation parameter-default 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">, | ||
isTypeReference: true, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
FunctionNameDefinition$2 { | ||
name: Identifier<"foo">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "foo", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
Variable$3 { | ||
defs: Array [], | ||
name: "arguments", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$4 { | ||
defs: Array [ | ||
ParameterDefinition$3 { | ||
name: Identifier<"a">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "a", | ||
references: Array [ | ||
Reference$2 { | ||
identifier: Identifier<"a">, | ||
init: true, | ||
isTypeReference: false, | ||
resolved: Variable$4, | ||
writeExpr: Literal$3, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$4, | ||
isStrict: false, | ||
references: Array [], | ||
set: Map { | ||
"T" => Variable$1, | ||
"foo" => Variable$2, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
Variable$1, | ||
Variable$2, | ||
], | ||
}, | ||
FunctionScope$2 { | ||
block: FunctionDeclaration$2, | ||
isStrict: false, | ||
references: Array [ | ||
Reference$1, | ||
Reference$2, | ||
], | ||
set: Map { | ||
"arguments" => Variable$3, | ||
"a" => Variable$4, | ||
}, | ||
type: "function", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$3, | ||
Variable$4, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
2 changes: 2 additions & 0 deletions
2
packages/scope-manager/tests/fixtures/type-annotation/parameter-object-destructure.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,2 @@ | ||
type T = {}; | ||
function foo({ a }: T) {} |
91 changes: 91 additions & 0 deletions
91
packages/scope-manager/tests/fixtures/type-annotation/parameter-object-destructure.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,91 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`type-annotation parameter-object-destructure 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">, | ||
isTypeReference: true, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
FunctionNameDefinition$2 { | ||
name: Identifier<"foo">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "foo", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
Variable$3 { | ||
defs: Array [], | ||
name: "arguments", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$4 { | ||
defs: Array [ | ||
ParameterDefinition$3 { | ||
name: Identifier<"a">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "a", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
], | ||
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, | ||
], | ||
}, | ||
FunctionScope$2 { | ||
block: FunctionDeclaration$2, | ||
isStrict: false, | ||
references: Array [ | ||
Reference$1, | ||
], | ||
set: Map { | ||
"arguments" => Variable$3, | ||
"a" => Variable$4, | ||
}, | ||
type: "function", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$3, | ||
Variable$4, | ||
], | ||
}, | ||
], | ||
} | ||
`; |
2 changes: 2 additions & 0 deletions
2
packages/scope-manager/tests/fixtures/type-annotation/parameter-rest.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,2 @@ | ||
type T = 1; | ||
function foo(...a: T[]) {} |
Oops, something went wrong.