-
-
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): support tagged template string generic type param…
…eters (#2492)
- Loading branch information
1 parent
9d8b4c4
commit a2686c0
Showing
4 changed files
with
166 additions
and
0 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
6 changes: 6 additions & 0 deletions
6
packages/scope-manager/tests/fixtures/type-declaration/type-parameters/tagged-template.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,6 @@ | ||
type StyledPaymentProps = { | ||
isValid: boolean; | ||
}; | ||
function div<T>(arg: any): void {} | ||
|
||
const StyledPayment = div<StyledPaymentProps>``; |
144 changes: 144 additions & 0 deletions
144
...ges/scope-manager/tests/fixtures/type-declaration/type-parameters/tagged-template.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,144 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`type-declaration type-parameters tagged-template 1`] = ` | ||
ScopeManager { | ||
variables: Array [ | ||
Variable$1 { | ||
defs: Array [ | ||
TypeDefinition$1 { | ||
name: Identifier<"StyledPaymentProps">, | ||
node: TSTypeAliasDeclaration$1, | ||
}, | ||
], | ||
name: "StyledPaymentProps", | ||
references: Array [ | ||
Reference$3 { | ||
identifier: Identifier<"StyledPaymentProps">, | ||
isRead: true, | ||
isTypeReference: true, | ||
isValueReference: false, | ||
isWrite: false, | ||
resolved: Variable$1, | ||
}, | ||
], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$2 { | ||
defs: Array [ | ||
FunctionNameDefinition$2 { | ||
name: Identifier<"div">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "div", | ||
references: Array [ | ||
Reference$2 { | ||
identifier: Identifier<"div">, | ||
isRead: true, | ||
isTypeReference: false, | ||
isValueReference: true, | ||
isWrite: false, | ||
resolved: Variable$2, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
Variable$3 { | ||
defs: Array [], | ||
name: "arguments", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: true, | ||
}, | ||
Variable$4 { | ||
defs: Array [ | ||
ParameterDefinition$3 { | ||
name: Identifier<"arg">, | ||
node: FunctionDeclaration$2, | ||
}, | ||
], | ||
name: "arg", | ||
references: Array [], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
Variable$5 { | ||
defs: Array [ | ||
TypeDefinition$4 { | ||
name: Identifier<"T">, | ||
node: TSTypeParameter$3, | ||
}, | ||
], | ||
name: "T", | ||
references: Array [], | ||
isValueVariable: false, | ||
isTypeVariable: true, | ||
}, | ||
Variable$6 { | ||
defs: Array [ | ||
VariableDefinition$5 { | ||
name: Identifier<"StyledPayment">, | ||
node: VariableDeclarator$4, | ||
}, | ||
], | ||
name: "StyledPayment", | ||
references: Array [ | ||
Reference$1 { | ||
identifier: Identifier<"StyledPayment">, | ||
init: true, | ||
isRead: false, | ||
isTypeReference: false, | ||
isValueReference: true, | ||
isWrite: true, | ||
resolved: Variable$6, | ||
writeExpr: TaggedTemplateExpression$5, | ||
}, | ||
], | ||
isValueVariable: true, | ||
isTypeVariable: false, | ||
}, | ||
], | ||
scopes: Array [ | ||
GlobalScope$1 { | ||
block: Program$6, | ||
isStrict: false, | ||
references: Array [ | ||
Reference$1, | ||
Reference$2, | ||
Reference$3, | ||
], | ||
set: Map { | ||
"StyledPaymentProps" => Variable$1, | ||
"div" => Variable$2, | ||
"StyledPayment" => Variable$6, | ||
}, | ||
type: "global", | ||
upper: null, | ||
variables: Array [ | ||
Variable$1, | ||
Variable$2, | ||
Variable$6, | ||
], | ||
}, | ||
FunctionScope$2 { | ||
block: FunctionDeclaration$2, | ||
isStrict: false, | ||
references: Array [], | ||
set: Map { | ||
"arguments" => Variable$3, | ||
"arg" => Variable$4, | ||
"T" => Variable$5, | ||
}, | ||
type: "function", | ||
upper: GlobalScope$1, | ||
variables: Array [ | ||
Variable$3, | ||
Variable$4, | ||
Variable$5, | ||
], | ||
}, | ||
], | ||
} | ||
`; |