diff --git a/packages/ast-spec/src/base/ClassBase.ts b/packages/ast-spec/src/base/ClassBase.ts index 4878cfc87b6..43e4da99d0a 100644 --- a/packages/ast-spec/src/base/ClassBase.ts +++ b/packages/ast-spec/src/base/ClassBase.ts @@ -61,7 +61,11 @@ export interface ClassBase extends BaseNode { * The generic type parameters passed to the superClass. * This is `undefined` if there are no generic type parameters passed. */ + superTypeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `superTypeArguments`} instead. */ superTypeParameters?: TSTypeParameterInstantiation; + /** * The generic type parameters declared for the class. * This is `undefined` if there are no generic type parameters declared. diff --git a/packages/ast-spec/src/base/TSHeritageBase.ts b/packages/ast-spec/src/base/TSHeritageBase.ts index 683600ec01d..b102123ca60 100644 --- a/packages/ast-spec/src/base/TSHeritageBase.ts +++ b/packages/ast-spec/src/base/TSHeritageBase.ts @@ -5,5 +5,8 @@ import type { BaseNode } from './BaseNode'; export interface TSHeritageBase extends BaseNode { // TODO(#1852) - this should be restricted to MemberExpression | Identifier expression: Expression; + typeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot index 43fbb02d6c0..313a1a2ca5c 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot @@ -36,6 +36,26 @@ Program { end: { column: 21, line: 1 }, }, }, + superTypeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot index d7a16a19520..91f3d48279a 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,98 @@ exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [30, 32], + loc: { + start: { column: 30, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: 'Identifier', + name: 'Set', + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +- superTypeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [22, 28], +- loc: { +- start: { column: 22, line: 1 }, +- end: { column: 28, line: 1 }, +- }, +- }, +- ], +- +- range: [21, 29], +- loc: { +- start: { column: 21, line: 1 }, +- end: { column: 29, line: 1 }, +- }, +- }, + superTypeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot index aac248040d8..ef17890bb62 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot @@ -36,6 +36,36 @@ Program { end: { column: 24, line: 1 }, }, }, + superTypeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot index f6d5a3c73b3..5c6479136e9 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot @@ -40,6 +40,36 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- end: { column: 24, line: 1 }, }, }, +- superTypeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [25, 26], +- loc: { +- start: { column: 25, line: 1 }, +- end: { column: 26, line: 1 }, +- }, +- }, +- +- range: [25, 26], +- loc: { +- start: { column: 25, line: 1 }, +- end: { column: 26, line: 1 }, +- }, +- }, +- ], +- +- range: [24, 27], +- loc: { +- start: { column: 24, line: 1 }, +- end: { column: 27, line: 1 }, +- }, +- }, superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ diff --git a/packages/ast-spec/src/expression/CallExpression/spec.ts b/packages/ast-spec/src/expression/CallExpression/spec.ts index bd71773a1be..bfe6e8d8d90 100644 --- a/packages/ast-spec/src/expression/CallExpression/spec.ts +++ b/packages/ast-spec/src/expression/CallExpression/spec.ts @@ -8,6 +8,10 @@ export interface CallExpression extends BaseNode { type: AST_NODE_TYPES.CallExpression; callee: LeftHandSideExpression; arguments: CallExpressionArgument[]; + typeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters?: TSTypeParameterInstantiation; + optional: boolean; } diff --git a/packages/ast-spec/src/expression/NewExpression/spec.ts b/packages/ast-spec/src/expression/NewExpression/spec.ts index 1ee93ef507d..dc0956c24a6 100644 --- a/packages/ast-spec/src/expression/NewExpression/spec.ts +++ b/packages/ast-spec/src/expression/NewExpression/spec.ts @@ -8,5 +8,8 @@ export interface NewExpression extends BaseNode { type: AST_NODE_TYPES.NewExpression; callee: LeftHandSideExpression; arguments: CallExpressionArgument[]; + typeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts b/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts index c0a9f9fd99b..064dd30612f 100644 --- a/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts +++ b/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts @@ -6,5 +6,8 @@ import type { Expression } from '../../unions/Expression'; export interface TSInstantiationExpression extends BaseNode { type: AST_NODE_TYPES.TSInstantiationExpression; expression: Expression; - typeParameters: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts index e3438484d9d..8bac918f4ca 100644 --- a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts @@ -6,7 +6,11 @@ import type { TemplateLiteral } from '../TemplateLiteral/spec'; export interface TaggedTemplateExpression extends BaseNode { type: AST_NODE_TYPES.TaggedTemplateExpression; + typeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters?: TSTypeParameterInstantiation; + tag: LeftHandSideExpression; quasi: TemplateLiteral; } diff --git a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts index 710fade02fa..d589842df98 100644 --- a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts +++ b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts @@ -7,7 +7,11 @@ import type { JSXSpreadAttribute } from '../JSXSpreadAttribute/spec'; export interface JSXOpeningElement extends BaseNode { type: AST_NODE_TYPES.JSXOpeningElement; + typeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters?: TSTypeParameterInstantiation; + selfClosing: boolean; name: JSXTagNameExpression; attributes: (JSXAttribute | JSXSpreadAttribute)[]; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot index f411fd3cb0b..288e7b2ed70 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot @@ -41,6 +41,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [147, 153], + loc: { + start: { column: 35, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + ], + + range: [146, 154], + loc: { + start: { column: 34, line: 4 }, + end: { column: 42, line: 4 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Promise", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot index cc059ebdd97..a39d1d8f6e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot @@ -50,6 +50,26 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [147, 153], +- loc: { +- start: { column: 35, line: 4 }, +- end: { column: 41, line: 4 }, +- }, +- }, +- ], +- +- range: [146, 154], +- loc: { +- start: { column: 34, line: 4 }, +- end: { column: 42, line: 4 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Promise', diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot index bf982a1b42e..2fc857bfdba 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot @@ -42,6 +42,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [139, 145], + loc: { + start: { column: 27, line: 4 }, + end: { column: 33, line: 4 }, + }, + }, + ], + + range: [138, 146], + loc: { + start: { column: 26, line: 4 }, + end: { column: 34, line: 4 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Promise", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot index ea291f87cbe..4db0ba1cb67 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot @@ -48,6 +48,26 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [139, 145], +- loc: { +- start: { column: 27, line: 4 }, +- end: { column: 33, line: 4 }, +- }, +- }, +- ], +- +- range: [138, 146], +- loc: { +- start: { column: 26, line: 4 }, +- end: { column: 34, line: 4 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Promise', diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot index 3859f9dbe85..ded2419b191 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot @@ -36,6 +36,55 @@ Program { end: { column: 34, line: 3 }, }, }, + superTypeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "C", + + range: [108, 109], + loc: { + start: { column: 35, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + + range: [108, 109], + loc: { + start: { column: 35, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "D", + + range: [111, 112], + loc: { + start: { column: 38, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + + range: [111, 112], + loc: { + start: { column: 38, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + ], + + range: [107, 113], + loc: { + start: { column: 34, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot index 543de450f92..ca63e23a86a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot @@ -40,6 +40,55 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple end: { column: 34, line: 3 }, }, }, +- superTypeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'C', +- +- range: [108, 109], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 36, line: 3 }, +- }, +- }, +- +- range: [108, 109], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 36, line: 3 }, +- }, +- }, +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'D', +- +- range: [111, 112], +- loc: { +- start: { column: 38, line: 3 }, +- end: { column: 39, line: 3 }, +- }, +- }, +- +- range: [111, 112], +- loc: { +- start: { column: 38, line: 3 }, +- end: { column: 39, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 113], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 40, line: 3 }, +- }, +- }, superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot index 9251113d68d..0eb56ff8f7a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot @@ -36,6 +36,36 @@ Program { end: { column: 24, line: 3 }, }, }, + superTypeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "B", + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [97, 100], + loc: { + start: { column: 24, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot index ac8187f4368..a97ace5c3c1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot @@ -40,6 +40,36 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig end: { column: 24, line: 3 }, }, }, +- superTypeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'B', +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- ], +- +- range: [97, 100], +- loc: { +- start: { column: 24, line: 3 }, +- end: { column: 27, line: 3 }, +- }, +- }, superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot index d8f94104032..9912ba6bbcc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot @@ -39,6 +39,55 @@ Program { end: { column: 24, line: 3 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "S", + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [101, 102], + loc: { + start: { column: 28, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [101, 102], + loc: { + start: { column: 28, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + + range: [97, 103], + loc: { + start: { column: 24, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot index 41b0e58926b..d85931ef054 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot @@ -43,6 +43,55 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi loc: { start: { column: 21, line: 3 }, end: { column: 24, line: 3 }, +- }, +- }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'S', +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [101, 102], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 29, line: 3 }, +- }, +- }, +- +- range: [101, 102], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 29, line: 3 }, +- }, +- }, +- ], +- +- range: [97, 103], +- loc: { +- start: { column: 24, line: 3 }, +- end: { column: 30, line: 3 }, }, }, typeParameters: TSTypeParameterInstantiation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot index 137d4920b36..75d8c33614f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot @@ -39,6 +39,36 @@ Program { end: { column: 24, line: 3 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "S", + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [97, 100], + loc: { + start: { column: 24, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot index 74cc49838e1..2f3b5490a9d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot @@ -43,6 +43,36 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A loc: { start: { column: 21, line: 3 }, end: { column: 24, line: 3 }, +- }, +- }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'S', +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- ], +- +- range: [97, 100], +- loc: { +- start: { column: 24, line: 3 }, +- end: { column: 27, line: 3 }, }, }, typeParameters: TSTypeParameterInstantiation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot index ab072a5f07b..373d4e7bae5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot @@ -76,6 +76,36 @@ Program { type: "TSTypeParameter", constraint: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "M", + + range: [106, 107], + loc: { + start: { column: 33, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [106, 107], + loc: { + start: { column: 33, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [105, 108], + loc: { + start: { column: 32, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Constructor", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot index 24ee207bc65..1656c11934c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot @@ -80,6 +80,36 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig type: 'TSTypeParameter', constraint: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'M', +- +- range: [106, 107], +- loc: { +- start: { column: 33, line: 3 }, +- end: { column: 34, line: 3 }, +- }, +- }, +- +- range: [106, 107], +- loc: { +- start: { column: 33, line: 3 }, +- end: { column: 34, line: 3 }, +- }, +- }, +- ], +- +- range: [105, 108], +- loc: { +- start: { column: 32, line: 3 }, +- end: { column: 35, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Constructor', diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot index 5a3bdce9ce1..62bbd5a6d78 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot @@ -116,6 +116,27 @@ Program { type: "TSTypeParameter", constraint: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [], + + range: [106, 108], + loc: { + start: { column: 33, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + ], + + range: [105, 109], + loc: { + start: { column: 32, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Constructor", @@ -256,6 +277,26 @@ Program { }, }, optional: false, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [175, 178], + loc: { + start: { column: 18, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + ], + + range: [174, 179], + loc: { + start: { column: 17, line: 7 }, + end: { column: 22, line: 7 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot index 8801f524ccc..6b48e3e25a5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot @@ -120,6 +120,27 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS type: 'TSTypeParameter', constraint: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeLiteral { +- type: 'TSTypeLiteral', +- members: Array [], +- +- range: [106, 108], +- loc: { +- start: { column: 33, line: 3 }, +- end: { column: 35, line: 3 }, +- }, +- }, +- ], +- +- range: [105, 109], +- loc: { +- start: { column: 32, line: 3 }, +- end: { column: 36, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Constructor', @@ -263,6 +284,26 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, }, optional: false, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSAnyKeyword { +- type: 'TSAnyKeyword', +- +- range: [175, 178], +- loc: { +- start: { column: 18, line: 7 }, +- end: { column: 21, line: 7 }, +- }, +- }, +- ], +- +- range: [174, 179], +- loc: { +- start: { column: 17, line: 7 }, +- end: { column: 22, line: 7 }, +- }, +- }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot index 6c9ddad5940..22ea837ae55 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot @@ -142,6 +142,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [145, 151], + loc: { + start: { column: 17, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + ], + + range: [144, 152], + loc: { + start: { column: 16, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot index 71bd9bfc1f1..543bea7d175 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,254 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', + name: 'name', + + range: [174, 178], + loc: { + start: { column: 9, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + + range: [167, 179], + loc: { + start: { column: 2, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + ], + + range: [163, 181], + loc: { + start: { column: 10, line: 7 }, + end: { column: 1, line: 9 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'message', + + range: [82, 89], + loc: { + start: { column: 9, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', + name: 'name', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [99, 105], + loc: { + start: { column: 8, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [97, 105], + loc: { + start: { column: 6, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [93, 105], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + AssignmentPattern { + type: 'AssignmentPattern', + left: Identifier { + type: 'Identifier', + name: 'age', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [114, 120], + loc: { + start: { column: 7, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [112, 120], + loc: { + start: { column: 5, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [109, 120], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + right: Literal { + type: 'Literal', + raw: '100', + value: 100, + + range: [123, 126], + loc: { + start: { column: 16, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [109, 126], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + RestElement { + type: 'RestElement', + argument: Identifier { + type: 'Identifier', + name: 'args', + + range: [133, 137], + loc: { + start: { column: 5, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [145, 151], +- loc: { +- start: { column: 17, line: 6 }, +- end: { column: 23, line: 6 }, +- }, +- }, +- ], +- +- range: [144, 152], +- loc: { +- start: { column: 16, line: 6 }, +- end: { column: 24, line: 6 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Array', + + range: [139, 144], + loc: { + start: { column: 11, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [145, 151], + loc: { + start: { column: 17, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + ], + + range: [144, 152], + loc: { + start: { column: 16, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + + range: [139, 152], + loc: { + start: { column: 11, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + + range: [137, 152], + loc: { + start: { column: 9, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + + range: [130, 152], + loc: { + start: { column: 2, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [156, 162], + loc: { + start: { column: 3, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [154, 162], + loc: { + start: { column: 1, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [73, 181], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 9 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 182], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 10 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot index ec9ca83ec2c..ba51eeaf2bc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot @@ -29,6 +29,36 @@ Program { end: { column: 28, line: 3 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "J", + + range: [102, 103], + loc: { + start: { column: 29, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + + range: [102, 103], + loc: { + start: { column: 29, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + ], + + range: [101, 104], + loc: { + start: { column: 28, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot index 54f1565f714..8743d1a6baf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -35,6 +35,36 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet end: { column: 28, line: 3 }, }, }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'J', +- +- range: [102, 103], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 30, line: 3 }, +- }, +- }, +- +- range: [102, 103], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 30, line: 3 }, +- }, +- }, +- ], +- +- range: [101, 104], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 31, line: 3 }, +- }, +- }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot index 8fdb5eba904..7cc4d89ca0c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,176 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + typeName: Identifier { + type: "Identifier", + name: "Array", + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [102, 115], + loc: { + start: { column: 29, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + + range: [101, 116], + loc: { + start: { column: 28, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + typeName: Identifier { + type: "Identifier", + name: "Array", + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + typeName: Identifier { + type: "Identifier", + name: "Array", + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [102, 115], + loc: { + start: { column: 29, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + + range: [101, 116], + loc: { + start: { column: 28, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + + range: [96, 116], + loc: { + start: { column: 23, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + ], + + range: [95, 117], + loc: { + start: { column: 22, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", @@ -31,6 +201,76 @@ Program { params: Array [ TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + typeName: Identifier { + type: "Identifier", + name: "Array", + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [102, 115], + loc: { + start: { column: 29, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + + range: [101, 116], + loc: { + start: { column: 28, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", @@ -46,6 +286,26 @@ Program { params: Array [ TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot index fff61afeb9b..7813a45fd01 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,419 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + id: Identifier { + type: 'Identifier', + name: 'nestedArray', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [108, 114], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 41, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 115], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Array', +- +- range: [102, 107], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 34, line: 3 }, +- }, +- }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [108, 114], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 41, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 115], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- +- range: [102, 115], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- ], +- +- range: [101, 116], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 43, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Array', +- +- range: [96, 101], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 28, line: 3 }, +- }, +- }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [108, 114], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 41, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 115], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Array', +- +- range: [102, 107], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 34, line: 3 }, +- }, +- }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [108, 114], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 41, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 115], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- +- range: [102, 115], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- ], +- +- range: [101, 116], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 43, line: 3 }, +- }, +- }, +- +- range: [96, 116], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 43, line: 3 }, +- }, +- }, +- ], +- +- range: [95, 117], +- loc: { +- start: { column: 22, line: 3 }, +- end: { column: 44, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Array', + + range: [90, 95], + loc: { + start: { column: 17, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [108, 114], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 41, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 115], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Array', +- +- range: [102, 107], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 34, line: 3 }, +- }, +- }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [108, 114], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 41, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 115], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- +- range: [102, 115], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, +- ], +- +- range: [101, 116], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 43, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Array', + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [108, 114], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 41, line: 3 }, +- }, +- }, +- ], +- +- range: [107, 115], +- loc: { +- start: { column: 34, line: 3 }, +- end: { column: 42, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Array', + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [102, 115], + loc: { + start: { column: 29, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + + range: [101, 116], + loc: { + start: { column: 28, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + + range: [96, 116], + loc: { + start: { column: 23, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + ], + + range: [95, 117], + loc: { + start: { column: 22, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [90, 117], + loc: { + start: { column: 17, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [88, 117], + loc: { + start: { column: 15, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [77, 117], + loc: { + start: { column: 4, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + init: null, + + range: [77, 117], + loc: { + start: { column: 4, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + kind: 'var', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 119], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot index 8fcc5c1ce1f..97820a6e6d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNeverKeyword { + type: "TSNeverKeyword", + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [81, 88], + loc: { + start: { column: 8, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "X", @@ -121,6 +141,26 @@ Program { }, }, optional: false, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNeverKeyword { + type: "TSNeverKeyword", + + range: [107, 112], + loc: { + start: { column: 17, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + ], + + range: [106, 113], + loc: { + start: { column: 16, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot index 3405c7b4b91..718e34a1d42 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,210 @@ exports[`AST Fixtures legacy-fixtures basics never-type-param AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + id: Identifier { + type: 'Identifier', + name: 'x', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNeverKeyword { +- type: 'TSNeverKeyword', +- +- range: [82, 87], +- loc: { +- start: { column: 9, line: 3 }, +- end: { column: 14, line: 3 }, +- }, +- }, +- ], +- +- range: [81, 88], +- loc: { +- start: { column: 8, line: 3 }, +- end: { column: 15, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'X', + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNeverKeyword { + type: 'TSNeverKeyword', + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [81, 88], + loc: { + start: { column: 8, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [80, 88], + loc: { + start: { column: 7, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [78, 88], + loc: { + start: { column: 5, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [77, 88], + loc: { + start: { column: 4, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + init: null, + + range: [77, 88], + loc: { + start: { column: 4, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ], + kind: 'var', + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', + name: 'Observable', + + range: [90, 100], + loc: { + start: { column: 0, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', + name: 'empty', + + range: [101, 106], + loc: { + start: { column: 11, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [90, 106], + loc: { + start: { column: 0, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNeverKeyword { +- type: 'TSNeverKeyword', +- +- range: [107, 112], +- loc: { +- start: { column: 17, line: 4 }, +- end: { column: 22, line: 4 }, +- }, +- }, +- ], +- +- range: [106, 113], +- loc: { +- start: { column: 16, line: 4 }, +- end: { column: 23, line: 4 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNeverKeyword { + type: 'TSNeverKeyword', + + range: [107, 112], + loc: { + start: { column: 17, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + ], + + range: [106, 113], + loc: { + start: { column: 16, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [90, 115], + loc: { + start: { column: 0, line: 4 }, + end: { column: 25, line: 4 }, + }, + }, + + range: [90, 116], + loc: { + start: { column: 0, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot index 81309039404..d0e7554b413 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot @@ -152,6 +152,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [104, 112], + loc: { + start: { column: 31, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "ReadonlyArray", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot index 8dceef59343..398454beb2d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,442 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', + name: 'arr', + + range: [118, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', + name: 'slice', + + range: [122, 127], + loc: { + start: { column: 6, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [118, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + optional: false, + + range: [118, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [118, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + Literal { + type: 'Literal', + raw: '\\\\'hello!\\\\'', + value: 'hello!', + + range: [150, 158], + loc: { + start: { column: 11, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + ], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', + name: 'arr', + + range: [141, 144], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', + name: 'push', + + range: [145, 149], + loc: { + start: { column: 6, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [141, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + + range: [141, 159], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + + range: [141, 160], + loc: { + start: { column: 2, line: 5 }, + end: { column: 21, line: 5 }, + }, + }, + ], + + range: [114, 172], + loc: { + start: { column: 41, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'foo', + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', + name: 'arr', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [105, 111], +- loc: { +- start: { column: 32, line: 3 }, +- end: { column: 38, line: 3 }, +- }, +- }, +- ], +- +- range: [104, 112], +- loc: { +- start: { column: 31, line: 3 }, +- end: { column: 39, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'ReadonlyArray', + + range: [91, 104], + loc: { + start: { column: 18, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [104, 112], + loc: { + start: { column: 31, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + + range: [91, 112], + loc: { + start: { column: 18, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + + range: [89, 112], + loc: { + start: { column: 16, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + + range: [86, 112], + loc: { + start: { column: 13, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + ], + + range: [73, 172], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', + name: 'arr', + + range: [215, 218], + loc: { + start: { column: 2, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', + name: 'slice', + + range: [219, 224], + loc: { + start: { column: 6, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [215, 224], + loc: { + start: { column: 2, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + optional: false, + + range: [215, 226], + loc: { + start: { column: 2, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + + range: [215, 227], + loc: { + start: { column: 2, line: 9 }, + end: { column: 14, line: 9 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + Literal { + type: 'Literal', + raw: '\\\\'hello!\\\\'', + value: 'hello!', + + range: [247, 255], + loc: { + start: { column: 11, line: 10 }, + end: { column: 19, line: 10 }, + }, + }, + ], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', + name: 'arr', + + range: [238, 241], + loc: { + start: { column: 2, line: 10 }, + end: { column: 5, line: 10 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', + name: 'push', + + range: [242, 246], + loc: { + start: { column: 6, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + + range: [238, 246], + loc: { + start: { column: 2, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + optional: false, + + range: [238, 256], + loc: { + start: { column: 2, line: 10 }, + end: { column: 20, line: 10 }, + }, + }, + + range: [238, 257], + loc: { + start: { column: 2, line: 10 }, + end: { column: 21, line: 10 }, + }, + }, + ], + + range: [211, 269], + loc: { + start: { column: 37, line: 8 }, + end: { column: 1, line: 11 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'foo', + + range: [183, 186], + loc: { + start: { column: 9, line: 8 }, + end: { column: 12, line: 8 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', + name: 'arr', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'readonly', + typeAnnotation: TSArrayType { + type: 'TSArrayType', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [201, 207], + loc: { + start: { column: 27, line: 8 }, + end: { column: 33, line: 8 }, + }, + }, + + range: [201, 209], + loc: { + start: { column: 27, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + + range: [192, 209], + loc: { + start: { column: 18, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + + range: [190, 209], + loc: { + start: { column: 16, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + + range: [187, 209], + loc: { + start: { column: 13, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + ], + + range: [174, 269], + loc: { + start: { column: 0, line: 8 }, + end: { column: 1, line: 11 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 270], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 12 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot index 3047970439e..b9b06647269 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot @@ -37,6 +37,35 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSSymbolKeyword { + type: "TSSymbolKeyword", + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + TSStringKeyword { + type: "TSStringKeyword", + + range: [104, 110], + loc: { + start: { column: 31, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + + range: [95, 111], + loc: { + start: { column: 22, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Map", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot index e99b60c13e3..05b325e0ad0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,149 @@ exports[`AST Fixtures legacy-fixtures basics symbol-type-param AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [113, 115], + loc: { + start: { column: 40, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'test', + + range: [82, 86], + loc: { + start: { column: 9, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', + name: 'abc', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSSymbolKeyword { +- type: 'TSSymbolKeyword', +- +- range: [96, 102], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 29, line: 3 }, +- }, +- }, +- TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [104, 110], +- loc: { +- start: { column: 31, line: 3 }, +- end: { column: 37, line: 3 }, +- }, +- }, +- ], +- +- range: [95, 111], +- loc: { +- start: { column: 22, line: 3 }, +- end: { column: 38, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Map', + + range: [92, 95], + loc: { + start: { column: 19, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + TSStringKeyword { + type: 'TSStringKeyword', + + range: [104, 110], + loc: { + start: { column: 31, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + + range: [95, 111], + loc: { + start: { column: 22, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [92, 111], + loc: { + start: { column: 19, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [90, 111], + loc: { + start: { column: 17, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [87, 111], + loc: { + start: { column: 14, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [73, 115], + loc: { + start: { column: 0, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 116], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot index 795cf38b0f5..3ef2c4b3537 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot @@ -21,6 +21,36 @@ Program { types: Array [ TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [109, 110], + loc: { + start: { column: 36, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + + range: [109, 110], + loc: { + start: { column: 36, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + + range: [108, 111], + loc: { + start: { column: 35, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Success", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot index dc8fc8c015a..168056ecf87 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot @@ -25,6 +25,36 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra types: Array [ TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [109, 110], +- loc: { +- start: { column: 36, line: 3 }, +- end: { column: 37, line: 3 }, +- }, +- }, +- +- range: [109, 110], +- loc: { +- start: { column: 36, line: 3 }, +- end: { column: 37, line: 3 }, +- }, +- }, +- ], +- +- range: [108, 111], +- loc: { +- start: { column: 35, line: 3 }, +- end: { column: 38, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Success', diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot index 0a8917e84b8..34a40d3d5f7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot @@ -21,6 +21,36 @@ Program { types: Array [ TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [98, 99], + loc: { + start: { column: 25, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [97, 100], + loc: { + start: { column: 24, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Success", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot index 37f3b64b54e..6e0d8613180 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot @@ -25,6 +25,36 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen types: Array [ TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- +- range: [98, 99], +- loc: { +- start: { column: 25, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- ], +- +- range: [97, 100], +- loc: { +- start: { column: 24, line: 3 }, +- end: { column: 27, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Success', diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot index 57fa3d178ed..4e35addc8df 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot @@ -18,6 +18,96 @@ Program { }, typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSImportType { + type: "TSImportType", + argument: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "''", + value: "", + + range: [91, 93], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [91, 93], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + qualifier: Identifier { + type: "Identifier", + name: "B", + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [97, 100], + loc: { + start: { column: 24, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [97, 100], + loc: { + start: { column: 24, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [84, 101], + loc: { + start: { column: 11, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], + + range: [83, 102], + loc: { + start: { column: 10, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "A", @@ -63,6 +153,26 @@ Program { end: { column: 23, line: 3 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [97, 100], + loc: { + start: { column: 24, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot index 9cbce47cd1c..3d2a86f859c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot @@ -22,6 +22,96 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete }, typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSImportType { +- type: 'TSImportType', +- argument: TSLiteralType { +- type: 'TSLiteralType', +- literal: Literal { +- type: 'Literal', +- raw: '\\\\'\\\\'', +- value: '', +- +- range: [91, 93], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 20, line: 3 }, +- }, +- }, +- +- range: [91, 93], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 20, line: 3 }, +- }, +- }, +- qualifier: Identifier { +- type: 'Identifier', +- name: 'B', +- +- range: [95, 96], +- loc: { +- start: { column: 22, line: 3 }, +- end: { column: 23, line: 3 }, +- }, +- }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSAnyKeyword { +- type: 'TSAnyKeyword', +- +- range: [97, 100], +- loc: { +- start: { column: 24, line: 3 }, +- end: { column: 27, line: 3 }, +- }, +- }, +- ], +- +- range: [96, 101], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 28, line: 3 }, +- }, +- }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSAnyKeyword { +- type: 'TSAnyKeyword', +- +- range: [97, 100], +- loc: { +- start: { column: 24, line: 3 }, +- end: { column: 27, line: 3 }, +- }, +- }, +- ], +- +- range: [96, 101], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 28, line: 3 }, +- }, +- }, +- +- range: [84, 101], +- loc: { +- start: { column: 11, line: 3 }, +- end: { column: 28, line: 3 }, +- }, +- }, +- ], +- +- range: [83, 102], +- loc: { +- start: { column: 10, line: 3 }, +- end: { column: 29, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'A', @@ -69,6 +159,26 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete loc: { start: { column: 22, line: 3 }, end: { column: 23, line: 3 }, +- }, +- }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSAnyKeyword { +- type: 'TSAnyKeyword', +- +- range: [97, 100], +- loc: { +- start: { column: 24, line: 3 }, +- end: { column: 27, line: 3 }, +- }, +- }, +- ], +- +- range: [96, 101], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 28, line: 3 }, }, }, typeParameters: TSTypeParameterInstantiation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot index 57e117c42f7..453dc72677f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot @@ -41,6 +41,7 @@ Program { }, }, qualifier: null, + typeArguments: null, typeParameters: null, range: [89, 100], @@ -107,6 +108,36 @@ Program { end: { column: 22, line: 4 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "Y", + + range: [125, 126], + loc: { + start: { column: 23, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + + range: [125, 126], + loc: { + start: { column: 23, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + ], + + range: [124, 127], + loc: { + start: { column: 22, line: 4 }, + end: { column: 25, line: 4 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot index 22d38f08fef..3c3c8c23b2f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot @@ -49,6 +49,7 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS }, }, - qualifier: null, +- typeArguments: null, - typeParameters: null, range: [89, 100], @@ -117,6 +118,36 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS loc: { start: { column: 21, line: 4 }, end: { column: 22, line: 4 }, +- }, +- }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'Y', +- +- range: [125, 126], +- loc: { +- start: { column: 23, line: 4 }, +- end: { column: 24, line: 4 }, +- }, +- }, +- +- range: [125, 126], +- loc: { +- start: { column: 23, line: 4 }, +- end: { column: 24, line: 4 }, +- }, +- }, +- ], +- +- range: [124, 127], +- loc: { +- start: { column: 22, line: 4 }, +- end: { column: 25, line: 4 }, }, }, typeParameters: TSTypeParameterInstantiation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot index 576e0c9b98a..94eed9630d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot @@ -36,6 +36,36 @@ Program { end: { column: 44, line: 3 }, }, }, + superTypeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "A", + + range: [128, 129], + loc: { + start: { column: 55, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [128, 129], + loc: { + start: { column: 55, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + ], + + range: [117, 140], + loc: { + start: { column: 44, line: 3 }, + end: { column: 67, line: 3 }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ @@ -137,6 +167,36 @@ Program { end: { column: 13, line: 6 }, }, }, + superTypeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "A", + + range: [219, 220], + loc: { + start: { column: 24, line: 6 }, + end: { column: 25, line: 6 }, + }, + }, + + range: [219, 220], + loc: { + start: { column: 24, line: 6 }, + end: { column: 25, line: 6 }, + }, + }, + ], + + range: [208, 231], + loc: { + start: { column: 13, line: 6 }, + end: { column: 36, line: 6 }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ @@ -251,6 +311,36 @@ Program { end: { column: 49, line: 7 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "A", + + range: [295, 296], + loc: { + start: { column: 60, line: 7 }, + end: { column: 61, line: 7 }, + }, + }, + + range: [295, 296], + loc: { + start: { column: 60, line: 7 }, + end: { column: 61, line: 7 }, + }, + }, + ], + + range: [284, 307], + loc: { + start: { column: 49, line: 7 }, + end: { column: 72, line: 7 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ @@ -363,6 +453,36 @@ Program { end: { column: 13, line: 9 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "A", + + range: [387, 388], + loc: { + start: { column: 24, line: 9 }, + end: { column: 25, line: 9 }, + }, + }, + + range: [387, 388], + loc: { + start: { column: 24, line: 9 }, + end: { column: 25, line: 9 }, + }, + }, + ], + + range: [376, 399], + loc: { + start: { column: 13, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot index d1bcce0c6fc..61551b391db 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot @@ -40,6 +40,36 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 44, line: 3 }, }, }, +- superTypeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'A', +- +- range: [128, 129], +- loc: { +- start: { column: 55, line: 3 }, +- end: { column: 56, line: 3 }, +- }, +- }, +- +- range: [128, 129], +- loc: { +- start: { column: 55, line: 3 }, +- end: { column: 56, line: 3 }, +- }, +- }, +- ], +- +- range: [117, 140], +- loc: { +- start: { column: 44, line: 3 }, +- end: { column: 67, line: 3 }, +- }, +- }, superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -79,7 +109,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - name: Identifier { - type: 'Identifier', - name: 'A', -- ++ name: 'A', + - range: [93, 94], - loc: { - start: { column: 20, line: 3 }, @@ -87,8 +118,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - }, - }, - out: false, -+ name: 'A', - +- range: [93, 94], loc: { start: { column: 20, line: 3 }, @@ -140,6 +170,36 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A loc: { start: { column: 10, line: 6 }, end: { column: 13, line: 6 }, +- }, +- }, +- superTypeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'A', +- +- range: [219, 220], +- loc: { +- start: { column: 24, line: 6 }, +- end: { column: 25, line: 6 }, +- }, +- }, +- +- range: [219, 220], +- loc: { +- start: { column: 24, line: 6 }, +- end: { column: 25, line: 6 }, +- }, +- }, +- ], +- +- range: [208, 231], +- loc: { +- start: { column: 13, line: 6 }, +- end: { column: 36, line: 6 }, }, }, superTypeParameters: TSTypeParameterInstantiation { @@ -257,6 +317,36 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A loc: { start: { column: 45, line: 7 }, end: { column: 49, line: 7 }, +- }, +- }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'A', +- +- range: [295, 296], +- loc: { +- start: { column: 60, line: 7 }, +- end: { column: 61, line: 7 }, +- }, +- }, +- +- range: [295, 296], +- loc: { +- start: { column: 60, line: 7 }, +- end: { column: 61, line: 7 }, +- }, +- }, +- ], +- +- range: [284, 307], +- loc: { +- start: { column: 49, line: 7 }, +- end: { column: 72, line: 7 }, }, }, typeParameters: TSTypeParameterInstantiation { @@ -372,6 +462,36 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A loc: { start: { column: 10, line: 9 }, end: { column: 13, line: 9 }, +- }, +- }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'A', +- +- range: [387, 388], +- loc: { +- start: { column: 24, line: 9 }, +- end: { column: 25, line: 9 }, +- }, +- }, +- +- range: [387, 388], +- loc: { +- start: { column: 24, line: 9 }, +- end: { column: 25, line: 9 }, +- }, +- }, +- ], +- +- range: [376, 399], +- loc: { +- start: { column: 13, line: 9 }, +- end: { column: 36, line: 9 }, }, }, typeParameters: TSTypeParameterInstantiation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot index 15fde1c2edb..19505507e6e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot @@ -20,6 +20,36 @@ Program { }, }, optional: false, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "A", + + range: [93, 94], + loc: { + start: { column: 20, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + + range: [93, 94], + loc: { + start: { column: 20, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + + range: [76, 111], + loc: { + start: { column: 3, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot index ff26a6e29d7..dfa3331ca0d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot @@ -24,6 +24,36 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm }, }, optional: false, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'A', +- +- range: [93, 94], +- loc: { +- start: { column: 20, line: 3 }, +- end: { column: 21, line: 3 }, +- }, +- }, +- +- range: [93, 94], +- loc: { +- start: { column: 20, line: 3 }, +- end: { column: 21, line: 3 }, +- }, +- }, +- ], +- +- range: [76, 111], +- loc: { +- start: { column: 3, line: 3 }, +- end: { column: 38, line: 3 }, +- }, +- }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -103,7 +133,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - name: Identifier { - type: 'Identifier', - name: 'A', -- ++ name: 'A', + - range: [138, 139], - loc: { - start: { column: 23, line: 4 }, @@ -111,8 +142,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - }, - }, - out: false, -+ name: 'A', - +- range: [138, 139], loc: { start: { column: 23, line: 4 }, @@ -182,8 +212,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm loc: { start: { column: 37, line: 5 }, end: { column: 40, line: 5 }, -- }, -- }, + }, + }, - in: false, - name: Identifier { - type: 'Identifier', @@ -193,8 +223,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - loc: { - start: { column: 23, line: 5 }, - end: { column: 24, line: 5 }, - }, - }, +- }, +- }, - out: false, + name: 'A', diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot index 4535f1eaac4..75dbf16b8c1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot @@ -29,6 +29,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [127, 130], + loc: { + start: { column: 30, line: 4 }, + end: { column: 33, line: 4 }, + }, + }, + ], + + range: [126, 147], + loc: { + start: { column: 29, line: 4 }, + end: { column: 50, line: 4 }, + }, + }, typeName: TSQualifiedName { type: "TSQualifiedName", left: Identifier { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot index 81d663d91cb..3d1129c5acf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot @@ -33,6 +33,26 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSAnyKeyword { +- type: 'TSAnyKeyword', +- +- range: [127, 130], +- loc: { +- start: { column: 30, line: 4 }, +- end: { column: 33, line: 4 }, +- }, +- }, +- ], +- +- range: [126, 147], +- loc: { +- start: { column: 29, line: 4 }, +- end: { column: 50, line: 4 }, +- }, +- }, typeName: TSQualifiedName { type: 'TSQualifiedName', left: Identifier { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 1e4239cbfce..1b469748f96 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -20,6 +20,36 @@ Program { }, }, optional: false, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "A", + + range: [77, 78], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + + range: [77, 78], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + ], + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ @@ -80,6 +110,26 @@ Program { }, }, optional: false, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNumberKeyword { + type: "TSNumberKeyword", + + range: [87, 93], + loc: { + start: { column: 4, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + + range: [86, 94], + loc: { + start: { column: 3, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 37371563dad..967a42b4d8d 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,179 @@ exports[`AST Fixtures legacy-fixtures expressions call-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', + name: 'foo', + + range: [73, 76], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'A', +- +- range: [77, 78], +- loc: { +- start: { column: 4, line: 3 }, +- end: { column: 5, line: 3 }, +- }, +- }, +- +- range: [77, 78], +- loc: { +- start: { column: 4, line: 3 }, +- end: { column: 5, line: 3 }, +- }, +- }, +- ], +- +- range: [76, 79], +- loc: { +- start: { column: 3, line: 3 }, +- end: { column: 6, line: 3 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'A', + + range: [77, 78], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + + range: [77, 78], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + ], + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', + name: 'foo', + + range: [83, 86], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNumberKeyword { +- type: 'TSNumberKeyword', +- +- range: [87, 93], +- loc: { +- start: { column: 4, line: 4 }, +- end: { column: 10, line: 4 }, +- }, +- }, +- ], +- +- range: [86, 94], +- loc: { +- start: { column: 3, line: 4 }, +- end: { column: 11, line: 4 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [87, 93], + loc: { + start: { column: 4, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + + range: [86, 94], + loc: { + start: { column: 3, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [83, 96], + loc: { + start: { column: 0, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [83, 97], + loc: { + start: { column: 0, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot index d25ae0fecae..b65621e0c46 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -32,6 +32,36 @@ Program { end: { column: 15, line: 3 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "B", + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 09f148a9083..47fd19df7a9 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,130 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + id: Identifier { + type: 'Identifier', + name: 'a', + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + init: NewExpression { + type: 'NewExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', + name: 'A', + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'B', +- +- range: [89, 90], +- loc: { +- start: { column: 16, line: 3 }, +- end: { column: 17, line: 3 }, +- }, +- }, +- +- range: [89, 90], +- loc: { +- start: { column: 16, line: 3 }, +- end: { column: 17, line: 3 }, +- }, +- }, +- ], +- +- range: [88, 91], +- loc: { +- start: { column: 15, line: 3 }, +- end: { column: 18, line: 3 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'B', + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [83, 93], + loc: { + start: { column: 10, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [79, 93], + loc: { + start: { column: 6, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + kind: 'const', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot index baeff97c25d..67168f76a86 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -43,6 +43,36 @@ Program { }, }, optional: false, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "A", + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + + range: [81, 84], + loc: { + start: { column: 8, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ @@ -133,6 +163,26 @@ Program { }, }, optional: false, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNumberKeyword { + type: "TSNumberKeyword", + + range: [97, 103], + loc: { + start: { column: 9, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + ], + + range: [96, 104], + loc: { + start: { column: 8, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index f0db811ffaf..562cb823f8f 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,239 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', + name: 'foo', + + range: [73, 76], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', + name: 'bar', + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'A', +- +- range: [82, 83], +- loc: { +- start: { column: 9, line: 3 }, +- end: { column: 10, line: 3 }, +- }, +- }, +- +- range: [82, 83], +- loc: { +- start: { column: 9, line: 3 }, +- end: { column: 10, line: 3 }, +- }, +- }, +- ], +- +- range: [81, 84], +- loc: { +- start: { column: 8, line: 3 }, +- end: { column: 11, line: 3 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'A', + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + + range: [81, 84], + loc: { + start: { column: 8, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', + name: 'foo', + + range: [88, 91], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', + name: 'bar', + + range: [93, 96], + loc: { + start: { column: 5, line: 4 }, + end: { column: 8, line: 4 }, + }, + }, + + range: [88, 96], + loc: { + start: { column: 0, line: 4 }, + end: { column: 8, line: 4 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNumberKeyword { +- type: 'TSNumberKeyword', +- +- range: [97, 103], +- loc: { +- start: { column: 9, line: 4 }, +- end: { column: 15, line: 4 }, +- }, +- }, +- ], +- +- range: [96, 104], +- loc: { +- start: { column: 8, line: 4 }, +- end: { column: 16, line: 4 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [97, 103], + loc: { + start: { column: 9, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + ], + + range: [96, 104], + loc: { + start: { column: 8, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [88, 106], + loc: { + start: { column: 0, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [88, 106], + loc: { + start: { column: 0, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [88, 107], + loc: { + start: { column: 0, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 532981ae134..737bf26abde 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -44,6 +44,36 @@ Program { end: { column: 3, line: 3 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "bar", + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + ], + + range: [76, 81], + loc: { + start: { column: 3, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 63ff0bf8c59..b36c5b7cb86 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,133 @@ exports[`AST Fixtures legacy-fixtures expressions tagged-template-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TaggedTemplateExpression { + type: 'TaggedTemplateExpression', + quasi: TemplateLiteral { + type: 'TemplateLiteral', + expressions: Array [], + quasis: Array [ + TemplateElement { + type: 'TemplateElement', + tail: true, + value: Object { + 'cooked': 'baz', + 'raw': 'baz', + }, + + range: [81, 86], + loc: { + start: { column: 8, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + ], + + range: [81, 86], + loc: { + start: { column: 8, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + tag: Identifier { + type: 'Identifier', + name: 'foo', + + range: [73, 76], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'bar', +- +- range: [77, 80], +- loc: { +- start: { column: 4, line: 3 }, +- end: { column: 7, line: 3 }, +- }, +- }, +- +- range: [77, 80], +- loc: { +- start: { column: 4, line: 3 }, +- end: { column: 7, line: 3 }, +- }, +- }, +- ], +- +- range: [76, 81], +- loc: { +- start: { column: 3, line: 3 }, +- end: { column: 8, line: 3 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'bar', + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + ], + + range: [76, 81], + loc: { + start: { column: 3, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot index c4767e22bd0..eaf0d5dcc37 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot @@ -61,6 +61,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [150, 153], + loc: { + start: { column: 54, line: 4 }, + end: { column: 57, line: 4 }, + }, + }, + ], + + range: [149, 154], + loc: { + start: { column: 53, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Selection", diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot index 0281bcdcbc1..0e9179ec241 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot @@ -65,6 +65,26 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSAnyKeyword { +- type: 'TSAnyKeyword', +- +- range: [150, 153], +- loc: { +- start: { column: 54, line: 4 }, +- end: { column: 57, line: 4 }, +- }, +- }, +- ], +- +- range: [149, 154], +- loc: { +- start: { column: 53, line: 4 }, +- end: { column: 58, line: 4 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Selection', diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot index 9bffe5d6717..9aeab0de28a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot @@ -150,6 +150,47 @@ Program { }, extendsType: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSInferType { + type: "TSInferType", + typeParameter: TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "U", + + range: [176, 177], + loc: { + start: { column: 28, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + out: false, + + range: [176, 177], + loc: { + start: { column: 28, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + + range: [170, 177], + loc: { + start: { column: 22, line: 7 }, + end: { column: 29, line: 7 }, + }, + }, + ], + + range: [169, 178], + loc: { + start: { column: 21, line: 7 }, + end: { column: 30, line: 7 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Promise", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot index 390ac4c254d..d93041d6a5c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot @@ -166,6 +166,47 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme }, extendsType: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSInferType { +- type: 'TSInferType', +- typeParameter: TSTypeParameter { +- type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [176, 177], +- loc: { +- start: { column: 28, line: 7 }, +- end: { column: 29, line: 7 }, +- }, +- }, +- out: false, +- +- range: [176, 177], +- loc: { +- start: { column: 28, line: 7 }, +- end: { column: 29, line: 7 }, +- }, +- }, +- +- range: [170, 177], +- loc: { +- start: { column: 22, line: 7 }, +- end: { column: 29, line: 7 }, +- }, +- }, +- ], +- +- range: [169, 178], +- loc: { +- start: { column: 21, line: 7 }, +- end: { column: 30, line: 7 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Promise', diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot index f63f70371c8..50862b4fa3e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot @@ -98,6 +98,36 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "U", + + range: [136, 137], + loc: { + start: { column: 63, line: 3 }, + end: { column: 64, line: 3 }, + }, + }, + + range: [136, 137], + loc: { + start: { column: 63, line: 3 }, + end: { column: 64, line: 3 }, + }, + }, + ], + + range: [135, 138], + loc: { + start: { column: 62, line: 3 }, + end: { column: 65, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "MustBeNumber", @@ -324,6 +354,36 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "U", + + range: [237, 238], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + + range: [237, 238], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [236, 239], + loc: { + start: { column: 16, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, typeName: Identifier { type: "Identifier", name: "MustBeNumber", @@ -541,6 +601,36 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "U", + + range: [325, 326], + loc: { + start: { column: 17, line: 8 }, + end: { column: 18, line: 8 }, + }, + }, + + range: [325, 326], + loc: { + start: { column: 17, line: 8 }, + end: { column: 18, line: 8 }, + }, + }, + ], + + range: [324, 327], + loc: { + start: { column: 16, line: 8 }, + end: { column: 19, line: 8 }, + }, + }, typeName: Identifier { type: "Identifier", name: "MustBeNumber", @@ -758,6 +848,36 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "U", + + range: [413, 414], + loc: { + start: { column: 17, line: 11 }, + end: { column: 18, line: 11 }, + }, + }, + + range: [413, 414], + loc: { + start: { column: 17, line: 11 }, + end: { column: 18, line: 11 }, + }, + }, + ], + + range: [412, 415], + loc: { + start: { column: 16, line: 11 }, + end: { column: 19, line: 11 }, + }, + }, typeName: Identifier { type: "Identifier", name: "MustBeNumber", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot index 5ae5b0f4966..b09be3c8f53 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot @@ -103,6 +103,36 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [136, 137], +- loc: { +- start: { column: 63, line: 3 }, +- end: { column: 64, line: 3 }, +- }, +- }, +- +- range: [136, 137], +- loc: { +- start: { column: 63, line: 3 }, +- end: { column: 64, line: 3 }, +- }, +- }, +- ], +- +- range: [135, 138], +- loc: { +- start: { column: 62, line: 3 }, +- end: { column: 65, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'MustBeNumber', @@ -332,6 +362,36 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [237, 238], +- loc: { +- start: { column: 17, line: 5 }, +- end: { column: 18, line: 5 }, +- }, +- }, +- +- range: [237, 238], +- loc: { +- start: { column: 17, line: 5 }, +- end: { column: 18, line: 5 }, +- }, +- }, +- ], +- +- range: [236, 239], +- loc: { +- start: { column: 16, line: 5 }, +- end: { column: 19, line: 5 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'MustBeNumber', @@ -552,6 +612,36 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [325, 326], +- loc: { +- start: { column: 17, line: 8 }, +- end: { column: 18, line: 8 }, +- }, +- }, +- +- range: [325, 326], +- loc: { +- start: { column: 17, line: 8 }, +- end: { column: 18, line: 8 }, +- }, +- }, +- ], +- +- range: [324, 327], +- loc: { +- start: { column: 16, line: 8 }, +- end: { column: 19, line: 8 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'MustBeNumber', @@ -772,6 +862,36 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [413, 414], +- loc: { +- start: { column: 17, line: 11 }, +- end: { column: 18, line: 11 }, +- }, +- }, +- +- range: [413, 414], +- loc: { +- start: { column: 17, line: 11 }, +- end: { column: 18, line: 11 }, +- }, +- }, +- ], +- +- range: [412, 415], +- loc: { +- start: { column: 16, line: 11 }, +- end: { column: 19, line: 11 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'MustBeNumber', @@ -959,8 +1079,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - name: Identifier { - type: 'Identifier', - name: 'U', -+ name: 'U', - +- - range: [481, 482], - loc: { - start: { column: 54, line: 13 }, @@ -968,7 +1087,8 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -- ++ name: 'U', + range: [481, 497], loc: { start: { column: 54, line: 13 }, diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot index 9178ec23de8..825b95c844b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,46 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSConstructorType { + type: "TSConstructorType", + abstract: false, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [93, 102], + loc: { + start: { column: 20, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [86, 102], + loc: { + start: { column: 13, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + + range: [85, 103], + loc: { + start: { column: 12, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot index 322828642b2..ec23f3c8380 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,46 @@ exports[`AST Fixtures legacy-fixtures types constructor-in-generic AST Alignment type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSConstructorType { +- type: 'TSConstructorType', +- abstract: false, +- params: Array [], +- returnType: TSTypeAnnotation { +- type: 'TSTypeAnnotation', +- typeAnnotation: TSStringKeyword { +- type: 'TSStringKeyword', +- +- range: [96, 102], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 29, line: 3 }, +- }, +- }, +- +- range: [93, 102], +- loc: { +- start: { column: 20, line: 3 }, +- end: { column: 29, line: 3 }, +- }, +- }, +- +- range: [86, 102], +- loc: { +- start: { column: 13, line: 3 }, +- end: { column: 29, line: 3 }, +- }, +- }, +- ], +- +- range: [85, 103], +- loc: { +- start: { column: 12, line: 3 }, +- end: { column: 30, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Array', diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot index ff04b86962a..c58a7832ac1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,45 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSFunctionType { + type: "TSFunctionType", + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [92, 96], + loc: { + start: { column: 19, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [89, 96], + loc: { + start: { column: 16, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [86, 96], + loc: { + start: { column: 13, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [85, 97], + loc: { + start: { column: 12, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot index 98ba2c71171..e36d96ae16a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,45 @@ exports[`AST Fixtures legacy-fixtures types function-in-generic AST Alignment - type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSFunctionType { +- type: 'TSFunctionType', +- params: Array [], +- returnType: TSTypeAnnotation { +- type: 'TSTypeAnnotation', +- typeAnnotation: TSVoidKeyword { +- type: 'TSVoidKeyword', +- +- range: [92, 96], +- loc: { +- start: { column: 19, line: 3 }, +- end: { column: 23, line: 3 }, +- }, +- }, +- +- range: [89, 96], +- loc: { +- start: { column: 16, line: 3 }, +- end: { column: 23, line: 3 }, +- }, +- }, +- +- range: [86, 96], +- loc: { +- start: { column: 13, line: 3 }, +- end: { column: 23, line: 3 }, +- }, +- }, +- ], +- +- range: [85, 97], +- loc: { +- start: { column: 12, line: 3 }, +- end: { column: 24, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'Array', diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot index de7addfe396..0bafaaee4ce 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot @@ -58,6 +58,36 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [117, 118], + loc: { + start: { column: 44, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + + range: [117, 118], + loc: { + start: { column: 44, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + ], + + range: [116, 119], + loc: { + start: { column: 43, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "LinkedList", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot index 4462a057b8b..17ec5b0d84b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot @@ -62,6 +62,36 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [117, 118], +- loc: { +- start: { column: 44, line: 3 }, +- end: { column: 45, line: 3 }, +- }, +- }, +- +- range: [117, 118], +- loc: { +- start: { column: 44, line: 3 }, +- end: { column: 45, line: 3 }, +- }, +- }, +- ], +- +- range: [116, 119], +- loc: { +- start: { column: 43, line: 3 }, +- end: { column: 46, line: 3 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'LinkedList', diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot index 237af44d7d8..753128d5502 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,76 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNumberKeyword { + type: "TSNumberKeyword", + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + ], + + range: [91, 99], + loc: { + start: { column: 18, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + typeName: Identifier { + type: "Identifier", + name: "Array", + + range: [86, 91], + loc: { + start: { column: 13, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNumberKeyword { + type: "TSNumberKeyword", + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + ], + + range: [91, 99], + loc: { + start: { column: 18, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [86, 99], + loc: { + start: { column: 13, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [85, 100], + loc: { + start: { column: 12, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", @@ -31,6 +101,26 @@ Program { params: Array [ TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNumberKeyword { + type: "TSNumberKeyword", + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + ], + + range: [91, 99], + loc: { + start: { column: 18, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot index 7a6abfb9236..43214d5f73f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,219 @@ exports[`AST Fixtures legacy-fixtures types reference-generic-nested AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + id: Identifier { + type: 'Identifier', + name: 'x', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNumberKeyword { +- type: 'TSNumberKeyword', +- +- range: [92, 98], +- loc: { +- start: { column: 19, line: 3 }, +- end: { column: 25, line: 3 }, +- }, +- }, +- ], +- +- range: [91, 99], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Array', +- +- range: [86, 91], +- loc: { +- start: { column: 13, line: 3 }, +- end: { column: 18, line: 3 }, +- }, +- }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNumberKeyword { +- type: 'TSNumberKeyword', +- +- range: [92, 98], +- loc: { +- start: { column: 19, line: 3 }, +- end: { column: 25, line: 3 }, +- }, +- }, +- ], +- +- range: [91, 99], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- +- range: [86, 99], +- loc: { +- start: { column: 13, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- ], +- +- range: [85, 100], +- loc: { +- start: { column: 12, line: 3 }, +- end: { column: 27, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Array', + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNumberKeyword { +- type: 'TSNumberKeyword', +- +- range: [92, 98], +- loc: { +- start: { column: 19, line: 3 }, +- end: { column: 25, line: 3 }, +- }, +- }, +- ], +- +- range: [91, 99], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Array', + + range: [86, 91], + loc: { + start: { column: 13, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + ], + + range: [91, 99], + loc: { + start: { column: 18, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [86, 99], + loc: { + start: { column: 13, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [85, 100], + loc: { + start: { column: 12, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [80, 100], + loc: { + start: { column: 7, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [78, 100], + loc: { + start: { column: 5, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [77, 100], + loc: { + start: { column: 4, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + init: null, + + range: [77, 100], + loc: { + start: { column: 4, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + kind: 'let', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot index 02e66cecda8..1740c35076c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,26 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSNumberKeyword { + type: "TSNumberKeyword", + + range: [86, 92], + loc: { + start: { column: 13, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Array", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot index 5653a047406..998644e9180 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,119 @@ exports[`AST Fixtures legacy-fixtures types reference-generic AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + id: Identifier { + type: 'Identifier', + name: 'x', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSNumberKeyword { +- type: 'TSNumberKeyword', +- +- range: [86, 92], +- loc: { +- start: { column: 13, line: 3 }, +- end: { column: 19, line: 3 }, +- }, +- }, +- ], +- +- range: [85, 93], +- loc: { +- start: { column: 12, line: 3 }, +- end: { column: 20, line: 3 }, +- }, +- }, + typeName: Identifier { + type: 'Identifier', + name: 'Array', + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [86, 92], + loc: { + start: { column: 13, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [80, 93], + loc: { + start: { column: 7, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [78, 93], + loc: { + start: { column: 5, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + init: null, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + kind: 'let', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot index 1b9878d79b7..6e8c437206f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot @@ -93,6 +93,36 @@ Program { types: Array [ TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [134, 135], + loc: { + start: { column: 15, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [134, 135], + loc: { + start: { column: 15, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + ], + + range: [133, 136], + loc: { + start: { column: 14, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Uppercase", @@ -142,6 +172,36 @@ Program { }, TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [152, 153], + loc: { + start: { column: 33, line: 4 }, + end: { column: 34, line: 4 }, + }, + }, + + range: [152, 153], + loc: { + start: { column: 33, line: 4 }, + end: { column: 34, line: 4 }, + }, + }, + ], + + range: [151, 154], + loc: { + start: { column: 32, line: 4 }, + end: { column: 35, line: 4 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Lowercase", @@ -191,6 +251,36 @@ Program { }, TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [171, 172], + loc: { + start: { column: 52, line: 4 }, + end: { column: 53, line: 4 }, + }, + }, + + range: [171, 172], + loc: { + start: { column: 52, line: 4 }, + end: { column: 53, line: 4 }, + }, + }, + ], + + range: [170, 173], + loc: { + start: { column: 51, line: 4 }, + end: { column: 54, line: 4 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Capitalize", @@ -240,6 +330,36 @@ Program { }, TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [192, 193], + loc: { + start: { column: 73, line: 4 }, + end: { column: 74, line: 4 }, + }, + }, + + range: [192, 193], + loc: { + start: { column: 73, line: 4 }, + end: { column: 74, line: 4 }, + }, + }, + ], + + range: [191, 194], + loc: { + start: { column: 72, line: 4 }, + end: { column: 75, line: 4 }, + }, + }, typeName: Identifier { type: "Identifier", name: "Uncapitalize", @@ -357,6 +477,37 @@ Program { }, typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "'heLLo'", + value: "heLLo", + + range: [232, 239], + loc: { + start: { column: 34, line: 5 }, + end: { column: 41, line: 5 }, + }, + }, + + range: [232, 239], + loc: { + start: { column: 34, line: 5 }, + end: { column: 41, line: 5 }, + }, + }, + ], + + range: [231, 240], + loc: { + start: { column: 33, line: 5 }, + end: { column: 42, line: 5 }, + }, + }, typeName: Identifier { type: "Identifier", name: "EnthusiasticGreeting", diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot index d6b807f6ded..5819613357d 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot @@ -96,7 +96,13 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - 'cooked': ' - ', - 'raw': ' - ', - }, -- ++ range: [134, 135], ++ loc: { ++ start: { column: 15, line: 4 }, ++ end: { column: 16, line: 4 }, ++ }, ++ }, + - range: [173, 179], - loc: { - start: { column: 54, line: 4 }, @@ -121,17 +127,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - types: Array [ - TSTypeReference { - type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'Uppercase', -- -- range: [124, 133], -- loc: { -- start: { column: 5, line: 4 }, -- end: { column: 14, line: 4 }, -- }, -- }, -- typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ - TSTypeReference { @@ -139,13 +135,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - typeName: Identifier { - type: 'Identifier', - name: 'T', -+ range: [134, 135], -+ loc: { -+ start: { column: 15, line: 4 }, -+ end: { column: 16, line: 4 }, -+ }, -+ }, - +- range: [134, 135], loc: { start: { column: 15, line: 4 }, @@ -165,22 +155,73 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + end: { column: 17, line: 4 }, }, - ], -+ }, - +- - range: [133, 136], +- loc: { +- start: { column: 14, line: 4 }, +- end: { column: 17, line: 4 }, + }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Uppercase', + +- range: [124, 133], + range: [124, 136], loc: { -- start: { column: 14, line: 4 }, -+ start: { column: 5, line: 4 }, - end: { column: 17, line: 4 }, + start: { column: 5, line: 4 }, +- end: { column: 14, line: 4 }, ++ end: { column: 17, line: 4 }, }, }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [134, 135], +- loc: { +- start: { column: 15, line: 4 }, +- end: { column: 16, line: 4 }, +- }, +- }, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Lowercase', +- range: [134, 135], +- loc: { +- start: { column: 15, line: 4 }, +- end: { column: 16, line: 4 }, +- }, ++ range: [142, 151], ++ loc: { ++ start: { column: 23, line: 4 }, ++ end: { column: 32, line: 4 }, + }, +- ], +- +- range: [133, 136], +- loc: { +- start: { column: 14, line: 4 }, +- end: { column: 17, line: 4 }, + }, +- }, ++ typeParameters: TSTypeParameterInstantiation { ++ type: 'TSTypeParameterInstantiation', ++ params: Array [ ++ TSTypeReference { ++ type: 'TSTypeReference', ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'T', + - range: [124, 136], - loc: { - start: { column: 5, line: 4 }, @@ -189,22 +230,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - }, - TSTypeReference { - type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'Lowercase', -- -- range: [142, 151], -- loc: { -- start: { column: 23, line: 4 }, -- end: { column: 32, line: 4 }, -+ range: [142, 151], -+ loc: { -+ start: { column: 23, line: 4 }, -+ end: { column: 32, line: 4 }, -+ }, - }, -- }, -- typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ - TSTypeReference { @@ -212,15 +238,6 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - typeName: Identifier { - type: 'Identifier', - name: 'T', -+ typeParameters: TSTypeParameterInstantiation { -+ type: 'TSTypeParameterInstantiation', -+ params: Array [ -+ TSTypeReference { -+ type: 'TSTypeReference', -+ typeName: Identifier { -+ type: 'Identifier', -+ name: 'T', -+ + range: [152, 153], + loc: { + start: { column: 33, line: 4 }, @@ -247,39 +264,64 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + end: { column: 35, line: 4 }, }, - ], -+ }, - +- - range: [151, 154], +- loc: { +- start: { column: 32, line: 4 }, +- end: { column: 35, line: 4 }, + }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Lowercase', + +- range: [142, 151], + range: [142, 154], loc: { -- start: { column: 32, line: 4 }, -+ start: { column: 23, line: 4 }, - end: { column: 35, line: 4 }, + start: { column: 23, line: 4 }, +- end: { column: 32, line: 4 }, ++ end: { column: 35, line: 4 }, }, }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [152, 153], +- loc: { +- start: { column: 33, line: 4 }, +- end: { column: 34, line: 4 }, +- }, +- }, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Capitalize', -- range: [142, 154], -- loc: { -- start: { column: 23, line: 4 }, -- end: { column: 35, line: 4 }, -- }, -- }, -- TSTypeReference { -- type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'Capitalize', +- range: [152, 153], +- loc: { +- start: { column: 33, line: 4 }, +- end: { column: 34, line: 4 }, +- }, + range: [160, 170], + loc: { + start: { column: 41, line: 4 }, + end: { column: 51, line: 4 }, -+ }, -+ }, + }, +- ], +- +- range: [151, 154], +- loc: { +- start: { column: 32, line: 4 }, +- end: { column: 35, line: 4 }, + }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ @@ -289,13 +331,15 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + type: 'Identifier', + name: 'T', -- range: [160, 170], -- loc: { -- start: { column: 41, line: 4 }, -- end: { column: 51, line: 4 }, -- }, +- range: [142, 154], +- loc: { +- start: { column: 23, line: 4 }, +- end: { column: 35, line: 4 }, - }, -- typeParameters: TSTypeParameterInstantiation { +- }, +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ - TSTypeReference { @@ -329,39 +373,64 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + end: { column: 54, line: 4 }, }, - ], -+ }, - +- - range: [170, 173], +- loc: { +- start: { column: 51, line: 4 }, +- end: { column: 54, line: 4 }, + }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Capitalize', + +- range: [160, 170], + range: [160, 173], loc: { -- start: { column: 51, line: 4 }, -+ start: { column: 41, line: 4 }, - end: { column: 54, line: 4 }, + start: { column: 41, line: 4 }, +- end: { column: 51, line: 4 }, ++ end: { column: 54, line: 4 }, }, }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [171, 172], +- loc: { +- start: { column: 52, line: 4 }, +- end: { column: 53, line: 4 }, +- }, +- }, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Uncapitalize', -- range: [160, 173], -- loc: { -- start: { column: 41, line: 4 }, -- end: { column: 54, line: 4 }, -- }, -- }, -- TSTypeReference { -- type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'Uncapitalize', +- range: [171, 172], +- loc: { +- start: { column: 52, line: 4 }, +- end: { column: 53, line: 4 }, +- }, + range: [179, 191], + loc: { + start: { column: 60, line: 4 }, + end: { column: 72, line: 4 }, -+ }, -+ }, + }, +- ], +- +- range: [170, 173], +- loc: { +- start: { column: 51, line: 4 }, +- end: { column: 54, line: 4 }, + }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ @@ -371,13 +440,15 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + type: 'Identifier', + name: 'T', -- range: [179, 191], -- loc: { -- start: { column: 60, line: 4 }, -- end: { column: 72, line: 4 }, -- }, +- range: [160, 173], +- loc: { +- start: { column: 41, line: 4 }, +- end: { column: 54, line: 4 }, - }, -- typeParameters: TSTypeParameterInstantiation { +- }, +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ - TSTypeReference { @@ -421,6 +492,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen end: { column: 75, line: 4 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- name: 'Uncapitalize', + ], + quasis: Array [ + TemplateElement { @@ -431,16 +505,23 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'raw': '', + }, -- range: [179, 194], -- loc: { -- start: { column: 60, line: 4 }, -- end: { column: 75, line: 4 }, +- range: [179, 191], + range: [121, 124], -+ loc: { + loc: { +- start: { column: 60, line: 4 }, +- end: { column: 72, line: 4 }, + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, -+ }, -+ }, + }, + }, +- typeParameters: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'T', + TemplateElement { + type: 'TemplateElement', + tail: false, @@ -448,7 +529,13 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'cooked': ' - ', + 'raw': ' - ', + }, -+ + +- range: [192, 193], +- loc: { +- start: { column: 73, line: 4 }, +- end: { column: 74, line: 4 }, +- }, +- }, + range: [136, 142], + loc: { + start: { column: 17, line: 4 }, @@ -462,7 +549,14 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'cooked': ' - ', + 'raw': ' - ', + }, -+ + +- range: [192, 193], +- loc: { +- start: { column: 73, line: 4 }, +- end: { column: 74, line: 4 }, +- }, +- }, +- ], + range: [154, 160], + loc: { + start: { column: 35, line: 4 }, @@ -476,13 +570,16 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'cooked': ' - ', + 'raw': ' - ', + }, -+ + +- range: [191, 194], + range: [173, 179], -+ loc: { + loc: { +- start: { column: 72, line: 4 }, +- end: { column: 75, line: 4 }, + start: { column: 54, line: 4 }, + end: { column: 60, line: 4 }, -+ }, -+ }, + }, + }, + TemplateElement { + type: 'TemplateElement', + tail: true, @@ -490,7 +587,11 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'cooked': '', + 'raw': '', + }, -+ + +- range: [179, 194], +- loc: { +- start: { column: 60, line: 4 }, +- end: { column: 75, line: 4 }, + range: [194, 196], + loc: { + start: { column: 75, line: 4 }, @@ -525,8 +626,8 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen loc: { start: { column: 36, line: 3 }, end: { column: 42, line: 3 }, -- }, -- }, + }, + }, - in: false, - name: Identifier { - type: 'Identifier', @@ -536,8 +637,8 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - loc: { - start: { column: 26, line: 3 }, - end: { column: 27, line: 3 }, - }, - }, +- }, +- }, - out: false, + name: 'T', @@ -576,6 +677,37 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen }, typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSLiteralType { +- type: 'TSLiteralType', +- literal: Literal { +- type: 'Literal', +- raw: '\\\\'heLLo\\\\'', +- value: 'heLLo', +- +- range: [232, 239], +- loc: { +- start: { column: 34, line: 5 }, +- end: { column: 41, line: 5 }, +- }, +- }, +- +- range: [232, 239], +- loc: { +- start: { column: 34, line: 5 }, +- end: { column: 41, line: 5 }, +- }, +- }, +- ], +- +- range: [231, 240], +- loc: { +- start: { column: 33, line: 5 }, +- end: { column: 42, line: 5 }, +- }, +- }, typeName: Identifier { type: 'Identifier', name: 'EnthusiasticGreeting', diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot index 95aaa57fb37..7b655eafbec 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -45,6 +45,36 @@ Program { end: { column: 17, line: 3 }, }, }, + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "w", + + range: [91, 92], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [91, 92], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: Array [ diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index 1ad2b5d62c4..a194ac6f2e6 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,158 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', + id: Identifier { + type: 'Identifier', + name: 'x', + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeQuery { + type: 'TSTypeQuery', + exprName: TSQualifiedName { + type: 'TSQualifiedName', + left: Identifier { + type: 'Identifier', + name: 'y', + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', + name: 'z', + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [87, 90], + loc: { + start: { column: 14, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- name: 'w', +- +- range: [91, 92], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 19, line: 3 }, +- }, +- }, +- +- range: [91, 92], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 19, line: 3 }, +- }, +- }, +- ], +- +- range: [90, 93], +- loc: { +- start: { column: 17, line: 3 }, +- end: { column: 20, line: 3 }, +- }, +- }, + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'w', + + range: [91, 92], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [91, 92], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [80, 93], + loc: { + start: { column: 7, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [78, 93], + loc: { + start: { column: 5, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + init: null, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + kind: 'let', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/type/TSImportType/spec.ts b/packages/ast-spec/src/type/TSImportType/spec.ts index fb2d33bfe11..3eb30235d9b 100644 --- a/packages/ast-spec/src/type/TSImportType/spec.ts +++ b/packages/ast-spec/src/type/TSImportType/spec.ts @@ -8,5 +8,8 @@ export interface TSImportType extends BaseNode { type: AST_NODE_TYPES.TSImportType; argument: TypeNode; qualifier: EntityName | null; + typeArguments: TSTypeParameterInstantiation | null; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters: TSTypeParameterInstantiation | null; } diff --git a/packages/ast-spec/src/type/TSTypeQuery/spec.ts b/packages/ast-spec/src/type/TSTypeQuery/spec.ts index bc9cb7e68d0..77318656eaa 100644 --- a/packages/ast-spec/src/type/TSTypeQuery/spec.ts +++ b/packages/ast-spec/src/type/TSTypeQuery/spec.ts @@ -7,5 +7,8 @@ import type { TSImportType } from '../TSImportType/spec'; export interface TSTypeQuery extends BaseNode { type: AST_NODE_TYPES.TSTypeQuery; exprName: EntityName | TSImportType; + typeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/type/TSTypeReference/spec.ts b/packages/ast-spec/src/type/TSTypeReference/spec.ts index 9d88fe7f6b4..a8b2a86733f 100644 --- a/packages/ast-spec/src/type/TSTypeReference/spec.ts +++ b/packages/ast-spec/src/type/TSTypeReference/spec.ts @@ -5,6 +5,10 @@ import type { EntityName } from '../../unions/EntityName'; export interface TSTypeReference extends BaseNode { type: AST_NODE_TYPES.TSTypeReference; - typeName: EntityName; + typeArguments?: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters?: TSTypeParameterInstantiation; + + typeName: EntityName; } diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index cef525143bf..018572d503d 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -2,6 +2,7 @@ exports[`AST Fixtures List fixtures with AST differences 1`] = ` Set { + "declaration/ClassDeclaration/fixtures/extends-type-param/fixture.ts", "declaration/ClassDeclaration/fixtures/implements-many/fixture.ts", "declaration/ClassDeclaration/fixtures/implements-one/fixture.ts", "declaration/ClassDeclaration/fixtures/type-param/fixture.ts", @@ -131,6 +132,7 @@ Set { "legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-types-assignation/fixture.ts", "legacy-fixtures/basics/fixtures/import-equal-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-equal-type-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-export-equal-declaration/fixture.ts", @@ -151,9 +153,13 @@ Set { "legacy-fixtures/basics/fixtures/interface-with-optional-properties/fixture.ts", "legacy-fixtures/basics/fixtures/intrinsic-keyword/fixture.ts", "legacy-fixtures/basics/fixtures/keyword-variables/fixture.ts", + "legacy-fixtures/basics/fixtures/nested-type-arguments/fixture.ts", + "legacy-fixtures/basics/fixtures/never-type-param/fixture.ts", "legacy-fixtures/basics/fixtures/object-with-escaped-properties/fixture.ts", "legacy-fixtures/basics/fixtures/object-with-typed-methods/fixture.ts", "legacy-fixtures/basics/fixtures/private-fields-in-in/fixture.ts", + "legacy-fixtures/basics/fixtures/readonly-arrays/fixture.ts", + "legacy-fixtures/basics/fixtures/symbol-type-param/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export/fixture.ts", @@ -178,6 +184,10 @@ Set { "legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/fixture.ts", "legacy-fixtures/declare/fixtures/module/fixture.ts", "legacy-fixtures/declare/fixtures/namespace/fixture.ts", + "legacy-fixtures/expressions/fixtures/call-expression-type-arguments/fixture.ts", + "legacy-fixtures/expressions/fixtures/new-expression-type-arguments/fixture.ts", + "legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/fixture.ts", + "legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/fixture.ts", "legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/fixture.ts", "legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/fixture.ts", "legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/fixture.ts", @@ -229,6 +239,8 @@ Set { "legacy-fixtures/types/fixtures/optional-variance-in-out/fixture.ts", "legacy-fixtures/types/fixtures/optional-variance-in/fixture.ts", "legacy-fixtures/types/fixtures/optional-variance-out/fixture.ts", + "legacy-fixtures/types/fixtures/reference-generic-nested/fixture.ts", + "legacy-fixtures/types/fixtures/reference-generic/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-2/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-3/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-4/fixture.ts", @@ -236,6 +248,7 @@ Set { "legacy-fixtures/types/fixtures/this-type/fixture.ts", "legacy-fixtures/types/fixtures/tuple-optional/fixture.ts", "legacy-fixtures/types/fixtures/typeof-this/fixture.ts", + "legacy-fixtures/types/fixtures/typeof-with-type-parameters/fixture.ts", "legacy-fixtures/types/fixtures/union-intersection/fixture.ts", } `; diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index d2fabdcc6ad..f30aebae1ef 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -32,14 +32,14 @@ function isSimpleType(node: TSESTree.Node): boolean { node.typeName.type === AST_NODE_TYPES.Identifier && node.typeName.name === 'Array' ) { - if (!node.typeParameters) { + if (!node.typeArguments) { return true; } - if (node.typeParameters.params.length === 1) { - return isSimpleType(node.typeParameters.params[0]); + if (node.typeArguments.params.length === 1) { + return isSimpleType(node.typeArguments.params[0]); } } else { - if (node.typeParameters) { + if (node.typeArguments) { return false; } return isSimpleType(node.typeName); @@ -219,7 +219,7 @@ export default util.createRule({ } const readonlyPrefix = isReadonlyArrayType ? 'readonly ' : ''; - const typeParams = node.typeParameters?.params; + const typeParams = node.typeArguments?.params; const messageId = currentOption === 'array' ? 'errorStringArray' diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index c6806f2a79d..8ba3c18198e 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -227,7 +227,7 @@ export default util.createRule({ TSTypeReference(node): void { checkBannedTypes(node.typeName); - if (node.typeParameters) { + if (node.typeArguments) { checkBannedTypes(node); } }, diff --git a/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts b/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts index baa28aae0a2..ed842628d9e 100644 --- a/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts +++ b/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts @@ -74,10 +74,10 @@ export default createRule({ return; } if (mode === 'type-annotation') { - if (!lhs && rhs.typeParameters) { - const { typeParameters, callee } = rhs; + if (!lhs && rhs.typeArguments) { + const { typeArguments, callee } = rhs; const typeAnnotation = - sourceCode.getText(callee) + sourceCode.getText(typeParameters); + sourceCode.getText(callee) + sourceCode.getText(typeArguments); context.report({ node, messageId: 'preferTypeAnnotation', @@ -96,7 +96,7 @@ export default createRule({ return sourceCode.getTokenAfter(node.key)!; } return [ - fixer.remove(typeParameters), + fixer.remove(typeArguments), fixer.insertTextAfter( getIDToAttachAnnotation(), ': ' + typeAnnotation, @@ -108,14 +108,14 @@ export default createRule({ return; } if (mode === 'constructor') { - if (lhs?.typeParameters && !rhs.typeParameters) { + if (lhs?.typeArguments && !rhs.typeArguments) { const hasParens = sourceCode.getTokenAfter(rhs.callee)?.value === '('; const extraComments = new Set( sourceCode.getCommentsInside(lhs.parent), ); sourceCode - .getCommentsInside(lhs.typeParameters) + .getCommentsInside(lhs.typeArguments) .forEach(c => extraComments.delete(c)); context.report({ node, @@ -130,7 +130,7 @@ export default createRule({ } yield fixer.insertTextAfter( rhs.callee, - sourceCode.getText(lhs.typeParameters), + sourceCode.getText(lhs.typeArguments), ); if (!hasParens) { yield fixer.insertTextAfter(rhs.callee, '()'); diff --git a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts index 4a1b475a16f..5d2f1118202 100644 --- a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts +++ b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts @@ -108,7 +108,7 @@ export default createRule({ return; } - const params = node.typeParameters?.params; + const params = node.typeArguments?.params; if (params?.length !== 2) { return; } diff --git a/packages/eslint-plugin/src/rules/func-call-spacing.ts b/packages/eslint-plugin/src/rules/func-call-spacing.ts index 0c737250526..cbb2bba5939 100644 --- a/packages/eslint-plugin/src/rules/func-call-spacing.ts +++ b/packages/eslint-plugin/src/rules/func-call-spacing.ts @@ -82,7 +82,7 @@ export default util.createRule({ const closingParenToken = sourceCode.getLastToken(node)!; const lastCalleeTokenWithoutPossibleParens = sourceCode.getLastToken( - node.typeParameters ?? node.callee, + node.typeArguments ?? node.callee, )!; const openingParenToken = sourceCode.getFirstTokenBetween( lastCalleeTokenWithoutPossibleParens, diff --git a/packages/eslint-plugin/src/rules/no-array-constructor.ts b/packages/eslint-plugin/src/rules/no-array-constructor.ts index 7ebff9b160d..fc71f275d7c 100644 --- a/packages/eslint-plugin/src/rules/no-array-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-array-constructor.ts @@ -31,7 +31,7 @@ export default util.createRule({ node.arguments.length !== 1 && node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === 'Array' && - !node.typeParameters && + !node.typeArguments && !util.isOptionalCallExpression(node) ) { context.report({ diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 8cef29d4a62..b3a150ad201 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -79,7 +79,7 @@ export default util.createRule({ if ( node.arguments.length === 1 && - node.typeParameters?.params.some( + node.typeArguments?.params.some( param => param.type === AST_NODE_TYPES.TSImportType || param.type === AST_NODE_TYPES.TSArrayType, diff --git a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts index ebfb1f53928..e367c3928be 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts @@ -156,9 +156,9 @@ export default util.createRule<[Options], MessageIds>({ validUnionMembers.includes(member.type) || // allows any T<..., void, ...> here, checked by checkGenericTypeArgument (member.type === AST_NODE_TYPES.TSTypeReference && - member.typeParameters?.type === + member.typeArguments?.type === AST_NODE_TYPES.TSTypeParameterInstantiation && - member.typeParameters?.params + member.typeArguments?.params .map(param => param.type) .includes(AST_NODE_TYPES.TSVoidKeyword)), ); diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 3a29daaf09a..16f811dc118 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -220,7 +220,7 @@ export default util.createRule({ const isValidGeneric = (type: TypeWithLabel): boolean => { return ( type.node.type === AST_NODE_TYPES.TSTypeReference && - type.node.typeParameters !== undefined + type.node.typeArguments !== undefined ); }; diff --git a/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts b/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts index 874455d5d9e..8c966eeea97 100644 --- a/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts +++ b/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts @@ -86,7 +86,7 @@ export default util.createRule({ ]), ]; - if (!callee.parent.typeParameters) { + if (!callee.parent.typeArguments) { fixes.push( fixer.insertTextAfter( callee, diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index 662b70813c8..a01cc78191e 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -74,7 +74,7 @@ class ClassVisitor extends Visitor { // visit the type param declarations this.visitType(node.typeParameters); // then the usages - this.visitType(node.superTypeParameters); + this.visitType(node.superTypeArguments); node.implements?.forEach(imp => this.visitType(imp)); this.visit(node.body); @@ -325,8 +325,8 @@ class ClassVisitor extends Visitor { this.#referencer.currentScope().referenceDualValueType(entityName); } - if (node.typeAnnotation.typeParameters) { - this.visitType(node.typeAnnotation.typeParameters); + if (node.typeAnnotation.typeArguments) { + this.visitType(node.typeAnnotation.typeArguments); } // everything is handled now diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 572d5be54ce..0a2cd05586a 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -386,8 +386,8 @@ class Referencer extends Visitor { } protected CallExpression(node: TSESTree.CallExpression): void { - this.visitChildren(node, ['typeParameters']); - this.visitType(node.typeParameters); + this.visitChildren(node, ['typeArguments']); + this.visitType(node.typeArguments); } protected CatchClause(node: TSESTree.CatchClause): void { @@ -540,7 +540,7 @@ class Referencer extends Visitor { } else { this.visit(node.name); } - this.visitType(node.typeParameters); + this.visitType(node.typeArguments); for (const attr of node.attributes) { this.visit(attr); } @@ -562,8 +562,8 @@ class Referencer extends Visitor { } protected NewExpression(node: TSESTree.NewExpression): void { - this.visitChildren(node, ['typeParameters']); - this.visitType(node.typeParameters); + this.visitChildren(node, ['typeArguments']); + this.visitType(node.typeArguments); } protected PrivateIdentifier(): void { @@ -613,7 +613,7 @@ class Referencer extends Visitor { ): void { this.visit(node.tag); this.visit(node.quasi); - this.visitType(node.typeParameters); + this.visitType(node.typeArguments); } protected TSAsExpression(node: TSESTree.TSAsExpression): void { @@ -695,8 +695,8 @@ class Referencer extends Visitor { protected TSInstantiationExpression( node: TSESTree.TSInstantiationExpression, ): void { - this.visitChildren(node, ['typeParameters']); - this.visitType(node.typeParameters); + this.visitChildren(node, ['typeArguments']); + this.visitType(node.typeArguments); } protected TSInterfaceDeclaration( diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index 899297ee12c..9daa2e64093 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -120,7 +120,7 @@ class TypeVisitor extends Visitor { protected TSImportType(node: TSESTree.TSImportType): void { // the TS parser allows any type to be the parameter, but it's a syntax error - so we can ignore it - this.visit(node.typeParameters); + this.visit(node.typeArguments); // the qualifier is just part of a standard EntityName, so it should not be visited } @@ -280,7 +280,7 @@ class TypeVisitor extends Visitor { this.#referencer.currentScope().referenceValue(entityName); } - this.visit(node.typeParameters); + this.visit(node.typeArguments); } protected TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void { diff --git a/packages/type-utils/src/isUnsafeAssignment.ts b/packages/type-utils/src/isUnsafeAssignment.ts index 4805b3fa4da..606fadfdd32 100644 --- a/packages/type-utils/src/isUnsafeAssignment.ts +++ b/packages/type-utils/src/isUnsafeAssignment.ts @@ -57,7 +57,7 @@ export function isUnsafeAssignment( senderNode.callee.type === AST_NODE_TYPES.Identifier && senderNode.callee.name === 'Map' && senderNode.arguments.length === 0 && - senderNode.typeParameters == null + senderNode.typeArguments == null ) { // special case to handle `new Map()` // unfortunately Map's default empty constructor is typed to return `Map` :( diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index ec1b335e6e7..20b8594f0f0 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1,5 +1,7 @@ // There's lots of funny stuff due to the typing of ts.Node /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access */ +// Additionally, we have some deprecated properties that won't be removed until v7 +/* eslint-disable deprecation/deprecation */ import * as ts from 'typescript'; import { getDecorators, getModifiers } from './getModifiers'; @@ -338,7 +340,7 @@ export class Converter { * @param node parent used to create this node * @returns TypeParameterInstantiation node */ - private convertTypeArgumentsToTypeParameters( + private convertTypeArgumentsToTypeParameterInstantiation( typeArguments: ts.NodeArray, node: TSESTreeToTSNode, ): TSESTree.TSTypeParameterInstantiation { @@ -474,9 +476,12 @@ export class Converter { : null; } if ('typeArguments' in node) { - result.typeParameters = + result.typeArguments = result.typeParameters = node.typeArguments && 'pos' in node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) : null; } if ('typeParameters' in node) { @@ -1549,18 +1554,21 @@ export class Converter { return result; } - case SyntaxKind.TaggedTemplateExpression: + case SyntaxKind.TaggedTemplateExpression: { + const typeArguments = node.typeArguments + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) + : undefined; return this.createNode(node, { type: AST_NODE_TYPES.TaggedTemplateExpression, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : undefined, + typeArguments, + typeParameters: typeArguments, tag: this.convertChild(node.tag), quasi: this.convertChild(node.template), }); + } case SyntaxKind.TemplateHead: case SyntaxKind.TemplateMiddle: @@ -1709,8 +1717,8 @@ export class Converter { } if (superClass.types[0]?.typeArguments) { - result.superTypeParameters = - this.convertTypeArgumentsToTypeParameters( + result.superTypeArguments = result.superTypeParameters = + this.convertTypeArgumentsToTypeParameterInstantiation( superClass.types[0].typeArguments, superClass.types[0], ); @@ -2055,10 +2063,11 @@ export class Converter { }); if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ); + result.typeArguments = result.typeParameters = + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); } return this.convertChainExpression(result, node); @@ -2074,10 +2083,11 @@ export class Converter { : [], }); if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ); + result.typeArguments = result.typeParameters = + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); } return result; } @@ -2225,6 +2235,12 @@ export class Converter { }); case SyntaxKind.JsxSelfClosingElement: { + const typeArguments = node.typeArguments + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) + : undefined; return this.createNode(node, { type: AST_NODE_TYPES.JSXElement, /** @@ -2233,12 +2249,8 @@ export class Converter { */ openingElement: this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningElement, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : undefined, + typeArguments, + typeParameters: typeArguments, selfClosing: true, name: this.convertJSXTagName(node.tagName, node), attributes: node.attributes.properties.map(el => @@ -2254,8 +2266,8 @@ export class Converter { case SyntaxKind.JsxOpeningElement: return this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningElement, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( + typeArguments: node.typeArguments + ? this.convertTypeArgumentsToTypeParameterInstantiation( node.typeArguments, node, ) @@ -2342,15 +2354,17 @@ export class Converter { // TypeScript specific case SyntaxKind.TypeReference: { + const typeArguments = node.typeArguments + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) + : undefined; return this.createNode(node, { type: AST_NODE_TYPES.TSTypeReference, typeName: this.convertChild(node.typeName), - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : undefined, + typeArguments, + typeParameters: typeArguments, }); } @@ -2431,12 +2445,17 @@ export class Converter { } case SyntaxKind.TypeQuery: { + const typeArguments = + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); return this.createNode(node, { type: AST_NODE_TYPES.TSTypeQuery, exprName: this.convertChild(node.exprName), - typeParameters: - node.typeArguments && - this.convertTypeArgumentsToTypeParameters(node.typeArguments, node), + typeArguments, + typeParameters: typeArguments, }); } @@ -2640,10 +2659,11 @@ export class Converter { }); if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ); + result.typeArguments = result.typeParameters = + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); } return result; } @@ -2717,16 +2737,18 @@ export class Converter { const token = findNextToken(node.getFirstToken()!, node, this.ast)!; range[0] = token.getStart(this.ast); } + const typeArguments = node.typeArguments + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) + : null; const result = this.createNode(node, { type: AST_NODE_TYPES.TSImportType, argument: this.convertChild(node.argument), qualifier: this.convertChild(node.qualifier), - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : null, + typeArguments, + typeParameters: typeArguments, range: range, }); if (node.isTypeOf) { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap index 45d71e34324..4439ae36ee0 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -96,6 +96,62 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` 12, ], "type": "NewExpression", + "typeArguments": { + "loc": { + "end": { + "column": 10, + "line": 1, + }, + "start": { + "column": 7, + "line": 1, + }, + }, + "params": [ + { + "loc": { + "end": { + "column": 9, + "line": 1, + }, + "start": { + "column": 8, + "line": 1, + }, + }, + "range": [ + 8, + 9, + ], + "type": "TSTypeReference", + "typeArguments": undefined, + "typeName": { + "loc": { + "end": { + "column": 9, + "line": 1, + }, + "start": { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": [ + 8, + 9, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": [ + 7, + 10, + ], + "type": "TSTypeParameterInstantiation", + }, "typeParameters": { "loc": { "end": { @@ -124,6 +180,7 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` 9, ], "type": "TSTypeReference", + "typeArguments": undefined, "typeName": { "loc": { "end": { @@ -349,6 +406,62 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` 12, ], "type": "TSNewExpression", + "typeArguments": { + "loc": { + "end": { + "column": 10, + "line": 1, + }, + "start": { + "column": 7, + "line": 1, + }, + }, + "params": [ + { + "loc": { + "end": { + "column": 9, + "line": 1, + }, + "start": { + "column": 8, + "line": 1, + }, + }, + "range": [ + 8, + 9, + ], + "type": "TSTypeReference", + "typeArguments": undefined, + "typeName": { + "loc": { + "end": { + "column": 9, + "line": 1, + }, + "start": { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": [ + 8, + 9, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": [ + 7, + 10, + ], + "type": "TSTypeParameterInstantiation", + }, "typeParameters": { "loc": { "end": { @@ -377,6 +490,7 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` 9, ], "type": "TSTypeReference", + "typeArguments": undefined, "typeName": { "loc": { "end": { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap index c290b538b20..58d69423139 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap @@ -156,6 +156,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with ], "selfClosing": true, "type": "JSXOpeningElement", + "typeArguments": undefined, "typeParameters": undefined, }, "range": [ @@ -445,6 +446,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with ], "selfClosing": true, "type": "JSXOpeningElement", + "typeArguments": undefined, "typeParameters": undefined, }, "range": [ @@ -1310,6 +1312,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", + "typeArguments": undefined, "typeParameters": undefined, }, "range": [ @@ -1599,6 +1602,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", + "typeArguments": undefined, "typeParameters": undefined, }, "range": [ @@ -2604,6 +2608,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", + "typeArguments": undefined, "typeParameters": undefined, }, "range": [ @@ -2893,6 +2898,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", + "typeArguments": undefined, "typeParameters": undefined, }, "range": [ @@ -3540,6 +3546,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with ], "selfClosing": true, "type": "JSXOpeningElement", + "typeArguments": undefined, "typeParameters": undefined, }, "range": [ diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index fedc412a361..4155b724ae1 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -138,7 +138,7 @@ const SharedVisitorKeys = (() => { 'id', 'typeParameters', 'superClass', - 'superTypeParameters', + 'superTypeArguments', 'implements', 'body', ], @@ -154,7 +154,7 @@ const additionalKeys: AdditionalKeys = { ArrayPattern: ['decorators', 'elements', 'typeAnnotation'], ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction, AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'], - CallExpression: ['callee', 'typeParameters', 'arguments'], + CallExpression: ['callee', 'typeArguments', 'arguments'], ClassDeclaration: SharedVisitorKeys.ClassDeclaration, ClassExpression: SharedVisitorKeys.ClassDeclaration, Decorator: ['expression'], @@ -167,16 +167,16 @@ const additionalKeys: AdditionalKeys = { ImportDeclaration: ['specifiers', 'source', 'assertions'], ImportExpression: ['source', 'attributes'], JSXClosingFragment: [], - JSXOpeningElement: ['name', 'typeParameters', 'attributes'], + JSXOpeningElement: ['name', 'typeArguments', 'attributes'], JSXOpeningFragment: [], JSXSpreadChild: ['expression'], MethodDefinition: ['decorators', 'key', 'value'], - NewExpression: ['callee', 'typeParameters', 'arguments'], + NewExpression: ['callee', 'typeArguments', 'arguments'], ObjectPattern: ['decorators', 'properties', 'typeAnnotation'], PropertyDefinition: SharedVisitorKeys.PropertyDefinition, RestElement: ['decorators', 'argument', 'typeAnnotation'], StaticBlock: ['body'], - TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], + TaggedTemplateExpression: ['tag', 'typeArguments', 'quasi'], TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition, TSAbstractKeyword: [], TSAbstractMethodDefinition: ['key', 'value'], @@ -188,7 +188,7 @@ const additionalKeys: AdditionalKeys = { TSBigIntKeyword: [], TSBooleanKeyword: [], TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType, - TSClassImplements: ['expression', 'typeParameters'], + TSClassImplements: ['expression', 'typeArguments'], TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'], TSConstructorType: SharedVisitorKeys.FunctionType, TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType, @@ -202,14 +202,14 @@ const additionalKeys: AdditionalKeys = { TSExternalModuleReference: ['expression'], TSFunctionType: SharedVisitorKeys.FunctionType, TSImportEqualsDeclaration: ['id', 'moduleReference'], - TSImportType: ['argument', 'qualifier', 'typeParameters'], + TSImportType: ['argument', 'qualifier', 'typeArguments'], TSIndexedAccessType: ['indexType', 'objectType'], TSIndexSignature: ['parameters', 'typeAnnotation'], TSInferType: ['typeParameter'], - TSInstantiationExpression: ['expression', 'typeParameters'], + TSInstantiationExpression: ['expression', 'typeArguments'], TSInterfaceBody: ['body'], TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'], - TSInterfaceHeritage: ['expression', 'typeParameters'], + TSInterfaceHeritage: ['expression', 'typeArguments'], TSIntersectionType: ['types'], TSIntrinsicKeyword: [], TSLiteralType: ['literal'], @@ -254,8 +254,8 @@ const additionalKeys: AdditionalKeys = { TSTypeParameterDeclaration: ['params'], TSTypeParameterInstantiation: ['params'], TSTypePredicate: ['typeAnnotation', 'parameterName'], - TSTypeQuery: ['exprName', 'typeParameters'], - TSTypeReference: ['typeName', 'typeParameters'], + TSTypeQuery: ['exprName', 'typeArguments'], + TSTypeReference: ['typeName', 'typeArguments'], TSUndefinedKeyword: [], TSUnionType: ['types'], TSUnknownKeyword: [],