Skip to content

Commit 66dc285

Browse files
authored
test(scope-manager): add missing test cases for typeof import (typescript-eslint#3101)
1 parent af5cbd5 commit 66dc285

File tree

4 files changed

+138
-0
lines changed

4 files changed

+138
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const x = { y: { z: 1 } };
2+
type T = typeof x.y.z;
3+
type Unresolved = x.y.z;
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`type-declaration type-query-qualified 1`] = `
4+
ScopeManager {
5+
variables: Array [
6+
ImplicitGlobalConstTypeVariable,
7+
Variable$2 {
8+
defs: Array [
9+
VariableDefinition$1 {
10+
name: Identifier<"x">,
11+
node: VariableDeclarator$1,
12+
},
13+
],
14+
name: "x",
15+
references: Array [
16+
Reference$1 {
17+
identifier: Identifier<"x">,
18+
init: true,
19+
isRead: false,
20+
isTypeReference: false,
21+
isValueReference: true,
22+
isWrite: true,
23+
resolved: Variable$2,
24+
writeExpr: ObjectExpression$2,
25+
},
26+
Reference$2 {
27+
identifier: Identifier<"x">,
28+
isRead: true,
29+
isTypeReference: false,
30+
isValueReference: true,
31+
isWrite: false,
32+
resolved: Variable$2,
33+
},
34+
],
35+
isValueVariable: true,
36+
isTypeVariable: false,
37+
},
38+
Variable$3 {
39+
defs: Array [
40+
TypeDefinition$2 {
41+
name: Identifier<"T">,
42+
node: TSTypeAliasDeclaration$3,
43+
},
44+
],
45+
name: "T",
46+
references: Array [],
47+
isValueVariable: false,
48+
isTypeVariable: true,
49+
},
50+
Variable$4 {
51+
defs: Array [
52+
TypeDefinition$3 {
53+
name: Identifier<"Unresolved">,
54+
node: TSTypeAliasDeclaration$4,
55+
},
56+
],
57+
name: "Unresolved",
58+
references: Array [],
59+
isValueVariable: false,
60+
isTypeVariable: true,
61+
},
62+
],
63+
scopes: Array [
64+
GlobalScope$1 {
65+
block: Program$5,
66+
isStrict: false,
67+
references: Array [
68+
Reference$1,
69+
Reference$2,
70+
Reference$3 {
71+
identifier: Identifier<"x">,
72+
isRead: true,
73+
isTypeReference: true,
74+
isValueReference: false,
75+
isWrite: false,
76+
resolved: null,
77+
},
78+
],
79+
set: Map {
80+
"const" => ImplicitGlobalConstTypeVariable,
81+
"x" => Variable$2,
82+
"T" => Variable$3,
83+
"Unresolved" => Variable$4,
84+
},
85+
type: "global",
86+
upper: null,
87+
variables: Array [
88+
ImplicitGlobalConstTypeVariable,
89+
Variable$2,
90+
Variable$3,
91+
Variable$4,
92+
],
93+
},
94+
],
95+
}
96+
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
type T = typeof import('').default;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`type-declaration typeof-import-type-with-qualifier 1`] = `
4+
ScopeManager {
5+
variables: Array [
6+
ImplicitGlobalConstTypeVariable,
7+
Variable$2 {
8+
defs: Array [
9+
TypeDefinition$1 {
10+
name: Identifier<"T">,
11+
node: TSTypeAliasDeclaration$1,
12+
},
13+
],
14+
name: "T",
15+
references: Array [],
16+
isValueVariable: false,
17+
isTypeVariable: true,
18+
},
19+
],
20+
scopes: Array [
21+
GlobalScope$1 {
22+
block: Program$2,
23+
isStrict: false,
24+
references: Array [],
25+
set: Map {
26+
"const" => ImplicitGlobalConstTypeVariable,
27+
"T" => Variable$2,
28+
},
29+
type: "global",
30+
upper: null,
31+
variables: Array [
32+
ImplicitGlobalConstTypeVariable,
33+
Variable$2,
34+
],
35+
},
36+
],
37+
}
38+
`;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy