Skip to content

Commit 08d757b

Browse files
fix: rename typeParameters to typeArguments where needed (#5384)
* fix!: rename typeParameters to typeArguments where needed * Fix type-utils > isUnsafeAssignment * Ignore the tets, why not * Corrected visitor-keys * Got implements, extends, and instantiation expressions * chore: check package.json existence in package-packages.ts * Rename superTypeArguments/Parameters too * Correct superTypeParameter/Argument(s) * Added deprecated properties too
1 parent 217c710 commit 08d757b

File tree

103 files changed

+6063
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+6063
-236
lines changed

packages/ast-spec/src/base/ClassBase.ts

+4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ export interface ClassBase extends BaseNode {
6161
* The generic type parameters passed to the superClass.
6262
* This is `undefined` if there are no generic type parameters passed.
6363
*/
64+
superTypeArguments?: TSTypeParameterInstantiation;
65+
66+
/** @deprecated Use {@link `superTypeArguments`} instead. */
6467
superTypeParameters?: TSTypeParameterInstantiation;
68+
6569
/**
6670
* The generic type parameters declared for the class.
6771
* This is `undefined` if there are no generic type parameters declared.

packages/ast-spec/src/base/TSHeritageBase.ts

+3
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ import type { BaseNode } from './BaseNode';
55
export interface TSHeritageBase extends BaseNode {
66
// TODO(#1852) - this should be restricted to MemberExpression | Identifier
77
expression: Expression;
8+
typeArguments?: TSTypeParameterInstantiation;
9+
10+
/** @deprecated Use {@link `typeArguments`} instead. */
811
typeParameters?: TSTypeParameterInstantiation;
912
}

packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot

+20
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ Program {
3636
end: { column: 21, line: 1 },
3737
},
3838
},
39+
superTypeArguments: TSTypeParameterInstantiation {
40+
type: "TSTypeParameterInstantiation",
41+
params: Array [
42+
TSStringKeyword {
43+
type: "TSStringKeyword",
44+
45+
range: [22, 28],
46+
loc: {
47+
start: { column: 22, line: 1 },
48+
end: { column: 28, line: 1 },
49+
},
50+
},
51+
],
52+
53+
range: [21, 29],
54+
loc: {
55+
start: { column: 21, line: 1 },
56+
end: { column: 29, line: 1 },
57+
},
58+
},
3959
superTypeParameters: TSTypeParameterInstantiation {
4060
type: "TSTypeParameterInstantiation",
4161
params: Array [

packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot

+94-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,98 @@
22

33
exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignment - AST 1`] = `
44
"Snapshot Diff:
5-
Compared values have no visual difference."
5+
- TSESTree
6+
+ Babel
7+
8+
Program {
9+
type: 'Program',
10+
body: Array [
11+
ClassDeclaration {
12+
type: 'ClassDeclaration',
13+
body: ClassBody {
14+
type: 'ClassBody',
15+
body: Array [],
16+
17+
range: [30, 32],
18+
loc: {
19+
start: { column: 30, line: 1 },
20+
end: { column: 32, line: 1 },
21+
},
22+
},
23+
id: Identifier {
24+
type: 'Identifier',
25+
name: 'Foo',
26+
27+
range: [6, 9],
28+
loc: {
29+
start: { column: 6, line: 1 },
30+
end: { column: 9, line: 1 },
31+
},
32+
},
33+
superClass: Identifier {
34+
type: 'Identifier',
35+
name: 'Set',
36+
37+
range: [18, 21],
38+
loc: {
39+
start: { column: 18, line: 1 },
40+
end: { column: 21, line: 1 },
41+
},
42+
},
43+
- superTypeArguments: TSTypeParameterInstantiation {
44+
- type: 'TSTypeParameterInstantiation',
45+
- params: Array [
46+
- TSStringKeyword {
47+
- type: 'TSStringKeyword',
48+
-
49+
- range: [22, 28],
50+
- loc: {
51+
- start: { column: 22, line: 1 },
52+
- end: { column: 28, line: 1 },
53+
- },
54+
- },
55+
- ],
56+
-
57+
- range: [21, 29],
58+
- loc: {
59+
- start: { column: 21, line: 1 },
60+
- end: { column: 29, line: 1 },
61+
- },
62+
- },
63+
superTypeParameters: TSTypeParameterInstantiation {
64+
type: 'TSTypeParameterInstantiation',
65+
params: Array [
66+
TSStringKeyword {
67+
type: 'TSStringKeyword',
68+
69+
range: [22, 28],
70+
loc: {
71+
start: { column: 22, line: 1 },
72+
end: { column: 28, line: 1 },
73+
},
74+
},
75+
],
76+
77+
range: [21, 29],
78+
loc: {
79+
start: { column: 21, line: 1 },
80+
end: { column: 29, line: 1 },
81+
},
82+
},
83+
84+
range: [0, 32],
85+
loc: {
86+
start: { column: 0, line: 1 },
87+
end: { column: 32, line: 1 },
88+
},
89+
},
90+
],
91+
sourceType: 'script',
92+
93+
range: [0, 33],
94+
loc: {
95+
start: { column: 0, line: 1 },
96+
end: { column: 0, line: 2 },
97+
},
98+
}"
699
`;

packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot

+30
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,36 @@ Program {
3636
end: { column: 24, line: 1 },
3737
},
3838
},
39+
superTypeArguments: TSTypeParameterInstantiation {
40+
type: "TSTypeParameterInstantiation",
41+
params: Array [
42+
TSTypeReference {
43+
type: "TSTypeReference",
44+
typeName: Identifier {
45+
type: "Identifier",
46+
name: "T",
47+
48+
range: [25, 26],
49+
loc: {
50+
start: { column: 25, line: 1 },
51+
end: { column: 26, line: 1 },
52+
},
53+
},
54+
55+
range: [25, 26],
56+
loc: {
57+
start: { column: 25, line: 1 },
58+
end: { column: 26, line: 1 },
59+
},
60+
},
61+
],
62+
63+
range: [24, 27],
64+
loc: {
65+
start: { column: 24, line: 1 },
66+
end: { column: 27, line: 1 },
67+
},
68+
},
3969
superTypeParameters: TSTypeParameterInstantiation {
4070
type: "TSTypeParameterInstantiation",
4171
params: Array [

packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot

+30
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,36 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-
4040
end: { column: 24, line: 1 },
4141
},
4242
},
43+
- superTypeArguments: TSTypeParameterInstantiation {
44+
- type: 'TSTypeParameterInstantiation',
45+
- params: Array [
46+
- TSTypeReference {
47+
- type: 'TSTypeReference',
48+
- typeName: Identifier {
49+
- type: 'Identifier',
50+
- name: 'T',
51+
-
52+
- range: [25, 26],
53+
- loc: {
54+
- start: { column: 25, line: 1 },
55+
- end: { column: 26, line: 1 },
56+
- },
57+
- },
58+
-
59+
- range: [25, 26],
60+
- loc: {
61+
- start: { column: 25, line: 1 },
62+
- end: { column: 26, line: 1 },
63+
- },
64+
- },
65+
- ],
66+
-
67+
- range: [24, 27],
68+
- loc: {
69+
- start: { column: 24, line: 1 },
70+
- end: { column: 27, line: 1 },
71+
- },
72+
- },
4373
superTypeParameters: TSTypeParameterInstantiation {
4474
type: 'TSTypeParameterInstantiation',
4575
params: Array [

packages/ast-spec/src/expression/CallExpression/spec.ts

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export interface CallExpression extends BaseNode {
88
type: AST_NODE_TYPES.CallExpression;
99
callee: LeftHandSideExpression;
1010
arguments: CallExpressionArgument[];
11+
typeArguments?: TSTypeParameterInstantiation;
12+
13+
/** @deprecated Use {@link `typeArguments`} instead. */
1114
typeParameters?: TSTypeParameterInstantiation;
15+
1216
optional: boolean;
1317
}

packages/ast-spec/src/expression/NewExpression/spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ export interface NewExpression extends BaseNode {
88
type: AST_NODE_TYPES.NewExpression;
99
callee: LeftHandSideExpression;
1010
arguments: CallExpressionArgument[];
11+
typeArguments?: TSTypeParameterInstantiation;
12+
13+
/** @deprecated Use {@link `typeArguments`} instead. */
1114
typeParameters?: TSTypeParameterInstantiation;
1215
}

packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ import type { Expression } from '../../unions/Expression';
66
export interface TSInstantiationExpression extends BaseNode {
77
type: AST_NODE_TYPES.TSInstantiationExpression;
88
expression: Expression;
9-
typeParameters: TSTypeParameterInstantiation;
9+
typeArguments: TSTypeParameterInstantiation;
10+
11+
/** @deprecated Use {@link `typeArguments`} instead. */
12+
typeParameters?: TSTypeParameterInstantiation;
1013
}

packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts

+4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import type { TemplateLiteral } from '../TemplateLiteral/spec';
66

77
export interface TaggedTemplateExpression extends BaseNode {
88
type: AST_NODE_TYPES.TaggedTemplateExpression;
9+
typeArguments?: TSTypeParameterInstantiation;
10+
11+
/** @deprecated Use {@link `typeArguments`} instead. */
912
typeParameters?: TSTypeParameterInstantiation;
13+
1014
tag: LeftHandSideExpression;
1115
quasi: TemplateLiteral;
1216
}

packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts

+4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import type { JSXSpreadAttribute } from '../JSXSpreadAttribute/spec';
77

88
export interface JSXOpeningElement extends BaseNode {
99
type: AST_NODE_TYPES.JSXOpeningElement;
10+
typeArguments?: TSTypeParameterInstantiation;
11+
12+
/** @deprecated Use {@link `typeArguments`} instead. */
1013
typeParameters?: TSTypeParameterInstantiation;
14+
1115
selfClosing: boolean;
1216
name: JSXTagNameExpression;
1317
attributes: (JSXAttribute | JSXSpreadAttribute)[];

packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot

+20
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@ Program {
4141
type: "TSTypeAnnotation",
4242
typeAnnotation: TSTypeReference {
4343
type: "TSTypeReference",
44+
typeArguments: TSTypeParameterInstantiation {
45+
type: "TSTypeParameterInstantiation",
46+
params: Array [
47+
TSStringKeyword {
48+
type: "TSStringKeyword",
49+
50+
range: [147, 153],
51+
loc: {
52+
start: { column: 35, line: 4 },
53+
end: { column: 41, line: 4 },
54+
},
55+
},
56+
],
57+
58+
range: [146, 154],
59+
loc: {
60+
start: { column: 34, line: 4 },
61+
end: { column: 42, line: 4 },
62+
},
63+
},
4464
typeName: Identifier {
4565
type: "Identifier",
4666
name: "Promise",

packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot

+20
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method
5050
type: 'TSTypeAnnotation',
5151
typeAnnotation: TSTypeReference {
5252
type: 'TSTypeReference',
53+
- typeArguments: TSTypeParameterInstantiation {
54+
- type: 'TSTypeParameterInstantiation',
55+
- params: Array [
56+
- TSStringKeyword {
57+
- type: 'TSStringKeyword',
58+
-
59+
- range: [147, 153],
60+
- loc: {
61+
- start: { column: 35, line: 4 },
62+
- end: { column: 41, line: 4 },
63+
- },
64+
- },
65+
- ],
66+
-
67+
- range: [146, 154],
68+
- loc: {
69+
- start: { column: 34, line: 4 },
70+
- end: { column: 42, line: 4 },
71+
- },
72+
- },
5373
typeName: Identifier {
5474
type: 'Identifier',
5575
name: 'Promise',

packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot

+20
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ Program {
4242
type: "TSTypeAnnotation",
4343
typeAnnotation: TSTypeReference {
4444
type: "TSTypeReference",
45+
typeArguments: TSTypeParameterInstantiation {
46+
type: "TSTypeParameterInstantiation",
47+
params: Array [
48+
TSStringKeyword {
49+
type: "TSStringKeyword",
50+
51+
range: [139, 145],
52+
loc: {
53+
start: { column: 27, line: 4 },
54+
end: { column: 33, line: 4 },
55+
},
56+
},
57+
],
58+
59+
range: [138, 146],
60+
loc: {
61+
start: { column: 26, line: 4 },
62+
end: { column: 34, line: 4 },
63+
},
64+
},
4565
typeName: Identifier {
4666
type: "Identifier",
4767
name: "Promise",

packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot

+20
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method
4848
type: 'TSTypeAnnotation',
4949
typeAnnotation: TSTypeReference {
5050
type: 'TSTypeReference',
51+
- typeArguments: TSTypeParameterInstantiation {
52+
- type: 'TSTypeParameterInstantiation',
53+
- params: Array [
54+
- TSStringKeyword {
55+
- type: 'TSStringKeyword',
56+
-
57+
- range: [139, 145],
58+
- loc: {
59+
- start: { column: 27, line: 4 },
60+
- end: { column: 33, line: 4 },
61+
- },
62+
- },
63+
- ],
64+
-
65+
- range: [138, 146],
66+
- loc: {
67+
- start: { column: 26, line: 4 },
68+
- end: { column: 34, line: 4 },
69+
- },
70+
- },
5171
typeName: Identifier {
5272
type: 'Identifier',
5373
name: 'Promise',

0 commit comments

Comments
 (0)