[babel 8] Use an identifier for TSTypeParameter.name (#12829)

This commit is contained in:
Federico Ciardi 2021-07-02 10:44:49 +02:00 committed by GitHub
parent 6df0b7c25f
commit 9bad558d13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
177 changed files with 4546 additions and 106 deletions

View File

@ -21,7 +21,11 @@ export function TSTypeParameterInstantiation(
export { TSTypeParameterInstantiation as TSTypeParameterDeclaration }; export { TSTypeParameterInstantiation as TSTypeParameterDeclaration };
export function TSTypeParameter(this: Printer, node: t.TSTypeParameter) { export function TSTypeParameter(this: Printer, node: t.TSTypeParameter) {
this.word(node.name); this.word(
!process.env.BABEL_8_BREAKING
? (node.name as unknown as string)
: (node.name as unknown as t.Identifier).name,
);
if (node.constraint) { if (node.constraint) {
this.space(); this.space();
@ -387,7 +391,11 @@ export function TSMappedType(this: Printer, node: t.TSMappedType) {
} }
this.token("["); this.token("[");
this.word(typeParameter.name); this.word(
!process.env.BABEL_8_BREAKING
? (typeParameter.name as unknown as string)
: (typeParameter.name as unknown as t.Identifier).name,
);
this.space(); this.space();
this.word("in"); this.word("in");
this.space(); this.space();

View File

@ -342,7 +342,13 @@ describe("generation", function () {
it("wraps around infer inside an array type", () => { it("wraps around infer inside an array type", () => {
const type = t.tsArrayType( const type = t.tsArrayType(
t.tsInferType(t.tsTypeParameter(null, null, "T")), t.tsInferType(
t.tsTypeParameter(
null,
null,
!process.env.BABEL_8_BREAKING ? "T" : t.identifier("T"),
),
),
); );
const output = generate(type).code; const output = generate(type).code;

View File

@ -485,7 +485,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
tsParseTypeParameter(): N.TsTypeParameter { tsParseTypeParameter(): N.TsTypeParameter {
const node: N.TsTypeParameter = this.startNode(); const node: N.TsTypeParameter = this.startNode();
node.name = this.parseIdentifierName(node.start); node.name = this.tsParseTypeParameterName();
node.constraint = this.tsEatThenParseType(tt._extends); node.constraint = this.tsEatThenParseType(tt._extends);
node.default = this.tsEatThenParseType(tt.eq); node.default = this.tsEatThenParseType(tt.eq);
return this.finishNode(node, "TSTypeParameter"); return this.finishNode(node, "TSTypeParameter");
@ -777,7 +777,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
tsParseMappedTypeParameter(): N.TsTypeParameter { tsParseMappedTypeParameter(): N.TsTypeParameter {
const node: N.TsTypeParameter = this.startNode(); const node: N.TsTypeParameter = this.startNode();
node.name = this.parseIdentifierName(node.start); node.name = this.tsParseTypeParameterName();
node.constraint = this.tsExpectThenParseType(tt._in); node.constraint = this.tsExpectThenParseType(tt._in);
return this.finishNode(node, "TSTypeParameter"); return this.finishNode(node, "TSTypeParameter");
} }
@ -1091,7 +1091,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
const node = this.startNode(); const node = this.startNode();
this.expectContextual("infer"); this.expectContextual("infer");
const typeParameter = this.startNode(); const typeParameter = this.startNode();
typeParameter.name = this.parseIdentifierName(typeParameter.start); typeParameter.name = this.tsParseTypeParameterName();
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter"); node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
return this.finishNode(node, "TSInferType"); return this.finishNode(node, "TSInferType");
} }
@ -3191,6 +3191,11 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return method; return method;
} }
tsParseTypeParameterName(): N.Identifier | string {
const typeName: N.Identifier = this.parseIdentifier();
return process.env.BABEL_8_BREAKING ? typeName : typeName.name;
}
shouldParseAsAmbientContext(): boolean { shouldParseAsAmbientContext(): boolean {
return !!this.getPluginOption("typescript", "dts"); return !!this.getPluginOption("typescript", "dts");
} }

View File

@ -960,7 +960,7 @@ export type TsTypeAnnotation = NodeBase & {
}; };
export type TypeParameterDeclarationBase = NodeBase & { export type TypeParameterDeclarationBase = NodeBase & {
params: $ReadOnlyArray<TypeParameterBase>, params: $ReadOnlyArray<TypeParameter | TsTypeParameter>,
}; };
export type TypeParameterDeclaration = TypeParameterDeclarationBase & { export type TypeParameterDeclaration = TypeParameterDeclarationBase & {
@ -973,17 +973,16 @@ export type TsTypeParameterDeclaration = TypeParameterDeclarationBase & {
params: $ReadOnlyArray<TsTypeParameter>, params: $ReadOnlyArray<TsTypeParameter>,
}; };
export type TypeParameterBase = NodeBase & { export type TypeParameter = NodeBase & {
name: string,
};
export type TypeParameter = TypeParameterBase & {
type: "TypeParameter", type: "TypeParameter",
name: string,
default?: TypeAnnotation, default?: TypeAnnotation,
}; };
export type TsTypeParameter = TypeParameterBase & { export type TsTypeParameter = NodeBase & {
type: "TSTypeParameter", type: "TSTypeParameter",
// TODO(Babel-8): remove string type support
name: string | Identifier,
constraint?: TsType, constraint?: TsType,
default?: TsType, default?: TsType,
}; };

View File

@ -0,0 +1,4 @@
{
"plugins": ["typescript"],
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,42 @@
{
"type": "File",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"program": {
"type": "Program",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"expression": {
"type": "ArrowFunctionExpression",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}},
"body": [],
"directives": []
},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
"params": [
{
"type": "TSTypeParameter",
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
"name": "div"
}
]
}
}
}
],
"directives": []
}
}

View File

@ -1,3 +1,4 @@
{ {
"plugins": ["typescript"] "plugins": ["typescript"],
"BABEL_8_BREAKING": true
} }

View File

@ -30,7 +30,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}}, "start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
"name": "div" "name": {
"type": "Identifier",
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4},"identifierName":"div"},
"name": "div"
}
} }
] ]
} }

View File

@ -0,0 +1 @@
async <T>() => await null;

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,44 @@
{
"type": "File",
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"program": {
"type": "Program",
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"expression": {
"type": "ArrowFunctionExpression",
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}},
"params": [
{
"type": "TSTypeParameter",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}},
"name": "T"
}
]
},
"params": [],
"id": null,
"generator": false,
"async": true,
"body": {
"type": "AwaitExpression",
"start":15,"end":25,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":25}},
"argument": {
"type": "NullLiteral",
"start":21,"end":25,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":25}}
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -20,7 +20,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}},
"name": "T" "name": {
"type": "Identifier",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,4 @@
async () => {
await null;
async <T>() => null;
};

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,71 @@
{
"type": "File",
"start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
"program": {
"type": "Program",
"start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":53,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}},
"expression": {
"type": "ArrowFunctionExpression",
"start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"id": null,
"generator": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start":12,"end":52,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}},
"body": [
{
"type": "ExpressionStatement",
"start":16,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}},
"expression": {
"type": "AwaitExpression",
"start":16,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}},
"argument": {
"type": "NullLiteral",
"start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12}}
}
}
},
{
"type": "ExpressionStatement",
"start":30,"end":50,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":22}},
"expression": {
"type": "ArrowFunctionExpression",
"start":30,"end":49,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":21}},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":36,"end":39,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":11}},
"params": [
{
"type": "TSTypeParameter",
"start":37,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}},
"name": "T"
}
]
},
"params": [],
"id": null,
"generator": false,
"async": true,
"body": {
"type": "NullLiteral",
"start":45,"end":49,"loc":{"start":{"line":3,"column":17},"end":{"line":3,"column":21}}
}
}
}
],
"directives": []
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -46,7 +46,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":37,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, "start":37,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}},
"name": "T" "name": {
"type": "Identifier",
"start":37,"end":38,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1 @@
async <T>(a: T): T => a;

View File

@ -0,0 +1,6 @@
{
"sourceType": "module",
"plugins": ["typescript"],
"tokens": true,
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,308 @@
{
"type": "File",
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
"program": {
"type": "Program",
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":24}},
"expression": {
"type": "ArrowFunctionExpression",
"start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}},
"params": [
{
"type": "TSTypeParameter",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}},
"name": "T"
}
]
},
"params": [
{
"type": "Identifier",
"start":10,"end":14,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":14},"identifierName":"a"},
"name": "a",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}},
"typeName": {
"type": "Identifier",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}},
"typeName": {
"type": "Identifier",
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"T"},
"name": "T"
}
}
},
"id": null,
"generator": false,
"async": true,
"body": {
"type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"a"},
"name": "a"
}
}
}
],
"directives": []
},
"tokens": [
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "async",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}
},
{
"type": {
"label": "</>/<=/>=",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": 7,
"updateContext": null
},
"value": "<",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "T",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}
},
{
"type": {
"label": "</>/<=/>=",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": 7,
"updateContext": null
},
"value": ">",
"start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9}}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "a",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}
},
{
"type": {
"label": ":",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "T",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}
},
{
"type": {
"label": ":",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "T",
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}}
},
{
"type": {
"label": "=>",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "a",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}
},
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}}
},
{
"type": {
"label": "eof",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start":24,"end":24,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":24}}
}
]
}

View File

@ -1,5 +1,6 @@
{ {
"sourceType": "module", "sourceType": "module",
"plugins": ["typescript"], "plugins": ["typescript"],
"tokens": true "tokens": true,
"BABEL_8_BREAKING": true
} }

View File

@ -20,7 +20,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}},
"name": "T" "name": {
"type": "Identifier",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1 @@
<T>(a: T): T => a;

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,73 @@
{
"type": "File",
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
"program": {
"type": "Program",
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}},
"expression": {
"type": "ArrowFunctionExpression",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}},
"returnType": {
"type": "TSTypeAnnotation",
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}},
"typeName": {
"type": "Identifier",
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"T"},
"name": "T"
}
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8},"identifierName":"a"},
"name": "a",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":5,"end":8,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":8}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}},
"typeName": {
"type": "Identifier",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"body": {
"type": "Identifier",
"start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17},"identifierName":"a"},
"name": "a"
},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":0,"end":3,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":3}},
"params": [
{
"type": "TSTypeParameter",
"start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}},
"name": "T"
}
]
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,2 @@
// Same as `generic`. Verify that JSX doesn't change things.
<T>(a: T): T => a;

View File

@ -0,0 +1,4 @@
{
"plugins": ["jsx", "typescript"],
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,87 @@
{
"type": "File",
"start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}},
"program": {
"type": "Program",
"start":0,"end":79,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":18}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":61,"end":79,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}},
"leadingComments": [
{
"type": "CommentLine",
"value": " Same as `generic`. Verify that JSX doesn't change things.",
"start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}
}
],
"expression": {
"type": "ArrowFunctionExpression",
"start":61,"end":78,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}},
"returnType": {
"type": "TSTypeAnnotation",
"start":70,"end":73,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":72,"end":73,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12}},
"typeName": {
"type": "Identifier",
"start":72,"end":73,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":12},"identifierName":"T"},
"name": "T"
}
}
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":65,"end":69,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":8},"identifierName":"a"},
"name": "a",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":66,"end":69,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":68,"end":69,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}},
"typeName": {
"type": "Identifier",
"start":68,"end":69,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"body": {
"type": "Identifier",
"start":77,"end":78,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":17},"identifierName":"a"},
"name": "a"
},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":61,"end":64,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":3}},
"params": [
{
"type": "TSTypeParameter",
"start":62,"end":63,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}},
"name": "T"
}
]
}
}
}
],
"directives": []
},
"comments": [
{
"type": "CommentLine",
"value": " Same as `generic`. Verify that JSX doesn't change things.",
"start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}
}
]
}

View File

@ -1,3 +1,4 @@
{ {
"plugins": ["jsx", "typescript"] "plugins": ["jsx", "typescript"],
"BABEL_8_BREAKING": true
} }

View File

@ -10,6 +10,13 @@
{ {
"type": "ExpressionStatement", "type": "ExpressionStatement",
"start":61,"end":79,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}}, "start":61,"end":79,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":18}},
"leadingComments": [
{
"type": "CommentLine",
"value": " Same as `generic`. Verify that JSX doesn't change things.",
"start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}
}
],
"expression": { "expression": {
"type": "ArrowFunctionExpression", "type": "ArrowFunctionExpression",
"start":61,"end":78,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}}, "start":61,"end":78,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":17}},
@ -61,18 +68,15 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":62,"end":63,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}}, "start":62,"end":63,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2}},
"name": "T" "name": {
"type": "Identifier",
"start":62,"end":63,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":2},"identifierName":"T"},
"name": "T"
}
} }
] ]
} }
}, }
"leadingComments": [
{
"type": "CommentLine",
"value": " Same as `generic`. Verify that JSX doesn't change things.",
"start":0,"end":60,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":60}}
}
]
} }
], ],
"directives": [] "directives": []

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -61,7 +61,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}, "start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}},
"name": "T" "name": {
"type": "Identifier",
"start":1,"end":2,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2},"identifierName":"T"},
"name": "T"
}
} }
] ]
} }

View File

@ -0,0 +1,3 @@
class C {
constructor<T>(foo: T) {}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,84 @@
{
"type": "File",
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"errors": [
"SyntaxError: Type parameters cannot appear on a constructor declaration. (2:13)"
],
"program": {
"type": "Program",
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
"name": "C"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":8,"end":39,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}},
"body": [
{
"type": "ClassMethod",
"start":12,"end":37,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}},
"static": false,
"key": {
"type": "Identifier",
"start":12,"end":23,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13},"identifierName":"constructor"},
"name": "constructor"
},
"computed": false,
"kind": "constructor",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":23,"end":26,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":16}},
"params": [
{
"type": "TSTypeParameter",
"start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":27,"end":33,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":23},"identifierName":"foo"},
"name": "foo",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":30,"end":33,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":23}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":32,"end":33,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23}},
"typeName": {
"type": "Identifier",
"start":32,"end":33,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":23},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"body": {
"type": "BlockStatement",
"start":35,"end":37,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":27}},
"body": [],
"directives": []
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -41,7 +41,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}}, "start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15}},
"name": "T" "name": {
"type": "Identifier",
"start":24,"end":25,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,2 @@
(class<T> {});
(class C<T> {});

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,77 @@
{
"type": "File",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}},
"program": {
"type": "Program",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"expression": {
"type": "ClassExpression",
"start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}},
"extra": {
"parenthesized": true,
"parenStart": 0
},
"id": null,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}},
"params": [
{
"type": "TSTypeParameter",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}},
"name": "T"
}
]
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}},
"body": []
}
}
},
{
"type": "ExpressionStatement",
"start":15,"end":31,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}},
"expression": {
"type": "ClassExpression",
"start":16,"end":29,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":14}},
"extra": {
"parenthesized": true,
"parenStart": 15
},
"id": {
"type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"C"},
"name": "C"
},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":23,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11}},
"params": [
{
"type": "TSTypeParameter",
"start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}},
"name": "T"
}
]
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":27,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}},
"body": []
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -13,6 +13,10 @@
"expression": { "expression": {
"type": "ClassExpression", "type": "ClassExpression",
"start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}}, "start":1,"end":12,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":12}},
"extra": {
"parenthesized": true,
"parenStart": 0
},
"id": null, "id": null,
"typeParameters": { "typeParameters": {
"type": "TSTypeParameterDeclaration", "type": "TSTypeParameterDeclaration",
@ -21,7 +25,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}, "start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}},
"name": "T" "name": {
"type": "Identifier",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -30,10 +38,6 @@
"type": "ClassBody", "type": "ClassBody",
"start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}},
"body": [] "body": []
},
"extra": {
"parenthesized": true,
"parenStart": 0
} }
} }
}, },
@ -43,6 +47,10 @@
"expression": { "expression": {
"type": "ClassExpression", "type": "ClassExpression",
"start":16,"end":29,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":14}}, "start":16,"end":29,"loc":{"start":{"line":2,"column":1},"end":{"line":2,"column":14}},
"extra": {
"parenthesized": true,
"parenStart": 15
},
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"C"}, "start":22,"end":23,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"C"},
@ -55,7 +63,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}}, "start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10}},
"name": "T" "name": {
"type": "Identifier",
"start":24,"end":25,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -64,10 +76,6 @@
"type": "ClassBody", "type": "ClassBody",
"start":27,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}}, "start":27,"end":29,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":14}},
"body": [] "body": []
},
"extra": {
"parenthesized": true,
"parenStart": 15
} }
} }
} }

View File

@ -0,0 +1 @@
class C<T extends object = { x: number }> {}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,67 @@
{
"type": "File",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}},
"program": {
"type": "Program",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":44}},
"id": {
"type": "Identifier",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
"name": "C"
},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":7,"end":41,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":41}},
"params": [
{
"type": "TSTypeParameter",
"start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":40}},
"name": "T",
"constraint": {
"type": "TSObjectKeyword",
"start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}
},
"default": {
"type": "TSTypeLiteral",
"start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}},
"members": [
{
"type": "TSPropertySignature",
"start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}},
"key": {
"type": "Identifier",
"start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"},
"name": "x"
},
"computed": false,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":30,"end":38,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":38}},
"typeAnnotation": {
"type": "TSNumberKeyword",
"start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}}
}
}
}
]
}
}
]
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}},
"body": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -22,7 +22,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":40}}, "start":8,"end":40,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":40}},
"name": "T", "name": {
"type": "Identifier",
"start":8,"end":9,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":9},"identifierName":"T"},
"name": "T"
},
"constraint": { "constraint": {
"type": "TSObjectKeyword", "type": "TSObjectKeyword",
"start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}} "start":18,"end":24,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":24}}

View File

@ -0,0 +1,3 @@
declare class C {
get<T>(): void;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,65 @@
{
"type": "File",
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"declare": true,
"id": {
"type": "Identifier",
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"C"},
"name": "C"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":16,"end":39,"loc":{"start":{"line":1,"column":16},"end":{"line":3,"column":1}},
"body": [
{
"type": "TSDeclareMethod",
"start":22,"end":37,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}},
"static": false,
"key": {
"type": "Identifier",
"start":22,"end":25,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":7},"identifierName":"get"},
"name": "get"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":25,"end":28,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":10}},
"params": [
{
"type": "TSTypeParameter",
"start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":30,"end":36,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":32,"end":36,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}
}
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -39,7 +39,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, "start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}},
"name": "T" "name": {
"type": "Identifier",
"start":26,"end":27,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,7 @@
class C {
public(): void;
public static(): void;
readonly = 0;
async<T>(): void;
abstract!:void;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,154 @@
{
"type": "File",
"start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
"program": {
"type": "Program",
"start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
"id": {
"type": "Identifier",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
"name": "C"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":8,"end":118,"loc":{"start":{"line":1,"column":8},"end":{"line":7,"column":1}},
"body": [
{
"type": "TSDeclareMethod",
"start":14,"end":29,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":19}},
"static": false,
"key": {
"type": "Identifier",
"start":14,"end":20,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":10},"identifierName":"public"},
"name": "public"
},
"computed": false,
"kind": "method",
"id": null,
"generator": false,
"async": false,
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":22,"end":28,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":18}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":24,"end":28,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":18}}
}
}
},
{
"type": "TSDeclareMethod",
"start":34,"end":56,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":26}},
"accessibility": "public",
"kind": "method",
"computed": false,
"key": {
"type": "Identifier",
"start":41,"end":47,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":17},"identifierName":"static"},
"name": "static"
},
"static": false,
"id": null,
"generator": false,
"async": false,
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":49,"end":55,"loc":{"start":{"line":3,"column":19},"end":{"line":3,"column":25}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":51,"end":55,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":25}}
}
}
},
{
"type": "ClassProperty",
"start":61,"end":74,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":17}},
"static": false,
"key": {
"type": "Identifier",
"start":61,"end":69,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":12},"identifierName":"readonly"},
"name": "readonly"
},
"computed": false,
"value": {
"type": "NumericLiteral",
"start":72,"end":73,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":16}},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "TSDeclareMethod",
"start":79,"end":96,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":21}},
"static": false,
"key": {
"type": "Identifier",
"start":79,"end":84,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":9},"identifierName":"async"},
"name": "async"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":84,"end":87,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":12}},
"params": [
{
"type": "TSTypeParameter",
"start":85,"end":86,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":11}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":89,"end":95,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":20}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":91,"end":95,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":20}}
}
}
},
{
"type": "ClassProperty",
"start":101,"end":116,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":19}},
"static": false,
"key": {
"type": "Identifier",
"start":101,"end":109,"loc":{"start":{"line":6,"column":4},"end":{"line":6,"column":12},"identifierName":"abstract"},
"name": "abstract"
},
"computed": false,
"definite": true,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":110,"end":115,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":18}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":111,"end":115,"loc":{"start":{"line":6,"column":14},"end":{"line":6,"column":18}}
}
},
"value": null
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -107,7 +107,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":85,"end":86,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":11}}, "start":85,"end":86,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":11}},
"name": "T" "name": {
"type": "Identifier",
"start":85,"end":86,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":11},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,4 @@
class C {
f<T>(a: T, b?: T, ...c: T[]): T {}
[Symbol.iterator]<T>(): T {}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,195 @@
{
"type": "File",
"start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"program": {
"type": "Program",
"start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"id": {
"type": "Identifier",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
"name": "C"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":8,"end":83,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}},
"body": [
{
"type": "ClassMethod",
"start":14,"end":48,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":38}},
"static": false,
"key": {
"type": "Identifier",
"start":14,"end":15,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"f"},
"name": "f"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":15,"end":18,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":8}},
"params": [
{
"type": "TSTypeParameter",
"start":16,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [
{
"type": "Identifier",
"start":19,"end":23,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":13},"identifierName":"a"},
"name": "a",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":20,"end":23,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":22,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}},
"typeName": {
"type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"T"},
"name": "T"
}
}
}
},
{
"type": "Identifier",
"start":25,"end":30,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":20},"identifierName":"b"},
"name": "b",
"optional": true,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":27,"end":30,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":20}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":29,"end":30,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}},
"typeName": {
"type": "Identifier",
"start":29,"end":30,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"T"},
"name": "T"
}
}
}
},
{
"type": "RestElement",
"start":32,"end":41,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":31}},
"argument": {
"type": "Identifier",
"start":35,"end":36,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26},"identifierName":"c"},
"name": "c"
},
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":36,"end":41,"loc":{"start":{"line":2,"column":26},"end":{"line":2,"column":31}},
"typeAnnotation": {
"type": "TSArrayType",
"start":38,"end":41,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":31}},
"elementType": {
"type": "TSTypeReference",
"start":38,"end":39,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29}},
"typeName": {
"type": "Identifier",
"start":38,"end":39,"loc":{"start":{"line":2,"column":28},"end":{"line":2,"column":29},"identifierName":"T"},
"name": "T"
}
}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":42,"end":45,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":35}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":44,"end":45,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35}},
"typeName": {
"type": "Identifier",
"start":44,"end":45,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":35},"identifierName":"T"},
"name": "T"
}
}
},
"body": {
"type": "BlockStatement",
"start":46,"end":48,"loc":{"start":{"line":2,"column":36},"end":{"line":2,"column":38}},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start":53,"end":81,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":32}},
"static": false,
"computed": true,
"key": {
"type": "MemberExpression",
"start":54,"end":69,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":20}},
"object": {
"type": "Identifier",
"start":54,"end":60,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"},
"name": "Symbol"
},
"computed": false,
"property": {
"type": "Identifier",
"start":61,"end":69,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"},
"name": "iterator"
}
},
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":70,"end":73,"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":24}},
"params": [
{
"type": "TSTypeParameter",
"start":71,"end":72,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":75,"end":78,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":29}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":77,"end":78,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":29}},
"typeName": {
"type": "Identifier",
"start":77,"end":78,"loc":{"start":{"line":3,"column":28},"end":{"line":3,"column":29},"identifierName":"T"},
"name": "T"
}
}
},
"body": {
"type": "BlockStatement",
"start":79,"end":81,"loc":{"start":{"line":3,"column":30},"end":{"line":3,"column":32}},
"body": [],
"directives": []
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -38,7 +38,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":16,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}}, "start":16,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7}},
"name": "T" "name": {
"type": "Identifier",
"start":16,"end":17,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":7},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -143,12 +147,12 @@
"start":54,"end":60,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"}, "start":54,"end":60,"loc":{"start":{"line":3,"column":5},"end":{"line":3,"column":11},"identifierName":"Symbol"},
"name": "Symbol" "name": "Symbol"
}, },
"computed": false,
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start":61,"end":69,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"}, "start":61,"end":69,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":20},"identifierName":"iterator"},
"name": "iterator" "name": "iterator"
}, }
"computed": false
}, },
"kind": "method", "kind": "method",
"typeParameters": { "typeParameters": {
@ -158,7 +162,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":71,"end":72,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23}}, "start":71,"end":72,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23}},
"name": "T" "name": {
"type": "Identifier",
"start":71,"end":72,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":23},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,9 @@
class C {
declare<T>() {}
readonly<T>() {}
abstract<T>() {}
static<T>() {}
private<T>() {}
public<T>() {}
protected<T>() {}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,260 @@
{
"type": "File",
"start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}},
"program": {
"type": "Program",
"start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ClassDeclaration",
"start":0,"end":139,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}},
"id": {
"type": "Identifier",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
"name": "C"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":8,"end":139,"loc":{"start":{"line":1,"column":8},"end":{"line":9,"column":1}},
"body": [
{
"type": "ClassMethod",
"start":12,"end":27,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}},
"static": false,
"key": {
"type": "Identifier",
"start":12,"end":19,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9},"identifierName":"declare"},
"name": "declare"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":19,"end":22,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}},
"params": [
{
"type": "TSTypeParameter",
"start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":25,"end":27,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":17}},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start":30,"end":46,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":18}},
"static": false,
"key": {
"type": "Identifier",
"start":30,"end":38,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":10},"identifierName":"readonly"},
"name": "readonly"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":38,"end":41,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":13}},
"params": [
{
"type": "TSTypeParameter",
"start":39,"end":40,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":44,"end":46,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":18}},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start":49,"end":65,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":18}},
"static": false,
"key": {
"type": "Identifier",
"start":49,"end":57,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":10},"identifierName":"abstract"},
"name": "abstract"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":57,"end":60,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":13}},
"params": [
{
"type": "TSTypeParameter",
"start":58,"end":59,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":63,"end":65,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":18}},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start":68,"end":82,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":16}},
"kind": "method",
"computed": false,
"key": {
"type": "Identifier",
"start":68,"end":74,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":8},"identifierName":"static"},
"name": "static"
},
"static": false,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":74,"end":77,"loc":{"start":{"line":5,"column":8},"end":{"line":5,"column":11}},
"params": [
{
"type": "TSTypeParameter",
"start":75,"end":76,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":80,"end":82,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":16}},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start":85,"end":100,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":17}},
"static": false,
"key": {
"type": "Identifier",
"start":85,"end":92,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":9},"identifierName":"private"},
"name": "private"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":92,"end":95,"loc":{"start":{"line":6,"column":9},"end":{"line":6,"column":12}},
"params": [
{
"type": "TSTypeParameter",
"start":93,"end":94,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":11}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":98,"end":100,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":17}},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start":103,"end":117,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":16}},
"static": false,
"key": {
"type": "Identifier",
"start":103,"end":109,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":8},"identifierName":"public"},
"name": "public"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":109,"end":112,"loc":{"start":{"line":7,"column":8},"end":{"line":7,"column":11}},
"params": [
{
"type": "TSTypeParameter",
"start":110,"end":111,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":10}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":115,"end":117,"loc":{"start":{"line":7,"column":14},"end":{"line":7,"column":16}},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start":120,"end":137,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":19}},
"static": false,
"key": {
"type": "Identifier",
"start":120,"end":129,"loc":{"start":{"line":8,"column":2},"end":{"line":8,"column":11},"identifierName":"protected"},
"name": "protected"
},
"computed": false,
"kind": "method",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":129,"end":132,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":14}},
"params": [
{
"type": "TSTypeParameter",
"start":130,"end":131,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":13}},
"name": "T"
}
]
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":135,"end":137,"loc":{"start":{"line":8,"column":17},"end":{"line":8,"column":19}},
"body": [],
"directives": []
}
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -38,7 +38,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}},
"name": "T" "name": {
"type": "Identifier",
"start":20,"end":21,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -71,7 +75,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":39,"end":40,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12}}, "start":39,"end":40,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12}},
"name": "T" "name": {
"type": "Identifier",
"start":39,"end":40,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":12},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -104,7 +112,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":58,"end":59,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12}}, "start":58,"end":59,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12}},
"name": "T" "name": {
"type": "Identifier",
"start":58,"end":59,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":12},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -137,7 +149,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":75,"end":76,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10}}, "start":75,"end":76,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10}},
"name": "T" "name": {
"type": "Identifier",
"start":75,"end":76,"loc":{"start":{"line":5,"column":9},"end":{"line":5,"column":10},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -170,7 +186,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":93,"end":94,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":11}}, "start":93,"end":94,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":11}},
"name": "T" "name": {
"type": "Identifier",
"start":93,"end":94,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":11},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -203,7 +223,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":110,"end":111,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":10}}, "start":110,"end":111,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":10}},
"name": "T" "name": {
"type": "Identifier",
"start":110,"end":111,"loc":{"start":{"line":7,"column":9},"end":{"line":7,"column":10},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -236,7 +260,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":130,"end":131,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":13}}, "start":130,"end":131,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":13}},
"name": "T" "name": {
"type": "Identifier",
"start":130,"end":131,"loc":{"start":{"line":8,"column":12},"end":{"line":8,"column":13},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1 @@
function f<T>(x?: T): T {}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,75 @@
{
"type": "File",
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"program": {
"type": "Program",
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}},
"id": {
"type": "Identifier",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"},
"name": "f"
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13}},
"params": [
{
"type": "TSTypeParameter",
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}},
"name": "T"
}
]
},
"params": [
{
"type": "Identifier",
"start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19},"identifierName":"x"},
"name": "x",
"optional": true,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}},
"typeName": {
"type": "Identifier",
"start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":20,"end":23,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":23}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}},
"typeName": {
"type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"T"},
"name": "T"
}
}
},
"body": {
"type": "BlockStatement",
"start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}},
"body": [],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -24,7 +24,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}}, "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}},
"name": "T" "name": {
"type": "Identifier",
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1 @@
const f = function<T>(x?: T): T {};

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,87 @@
{
"type": "File",
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
"program": {
"type": "Program",
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "VariableDeclaration",
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
"declarations": [
{
"type": "VariableDeclarator",
"start":6,"end":34,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":34}},
"id": {
"type": "Identifier",
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"f"},
"name": "f"
},
"init": {
"type": "FunctionExpression",
"start":10,"end":34,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":34}},
"id": null,
"generator": false,
"async": false,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21}},
"params": [
{
"type": "TSTypeParameter",
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}},
"name": "T"
}
]
},
"params": [
{
"type": "Identifier",
"start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27},"identifierName":"x"},
"name": "x",
"optional": true,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27}},
"typeName": {
"type": "Identifier",
"start":26,"end":27,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":27},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}},
"typeName": {
"type": "Identifier",
"start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"T"},
"name": "T"
}
}
},
"body": {
"type": "BlockStatement",
"start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}},
"body": [],
"directives": []
}
}
}
],
"kind": "const"
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
const fn = function* <T>(input: T): Generator<number> {
yield 2;
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,115 @@
{
"type": "File",
"start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "VariableDeclaration",
"start":0,"end":68,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"declarations": [
{
"type": "VariableDeclarator",
"start":6,"end":68,"loc":{"start":{"line":1,"column":6},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8},"identifierName":"fn"},
"name": "fn"
},
"init": {
"type": "FunctionExpression",
"start":11,"end":68,"loc":{"start":{"line":1,"column":11},"end":{"line":3,"column":1}},
"id": null,
"generator": true,
"async": false,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":21,"end":24,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":24}},
"params": [
{
"type": "TSTypeParameter",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}},
"name": "T"
}
]
},
"params": [
{
"type": "Identifier",
"start":25,"end":33,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":33},"identifierName":"input"},
"name": "input",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":30,"end":33,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":33}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}},
"typeName": {
"type": "Identifier",
"start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"returnType": {
"type": "TSTypeAnnotation",
"start":34,"end":53,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":53}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":36,"end":53,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":53}},
"typeName": {
"type": "Identifier",
"start":36,"end":45,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":45},"identifierName":"Generator"},
"name": "Generator"
},
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"start":45,"end":53,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":53}},
"params": [
{
"type": "TSNumberKeyword",
"start":46,"end":52,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":52}}
}
]
}
}
},
"body": {
"type": "BlockStatement",
"start":54,"end":68,"loc":{"start":{"line":1,"column":54},"end":{"line":3,"column":1}},
"body": [
{
"type": "ExpressionStatement",
"start":58,"end":66,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}},
"expression": {
"type": "YieldExpression",
"start":58,"end":65,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":9}},
"delegate": false,
"argument": {
"type": "NumericLiteral",
"start":64,"end":65,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
}
}
],
"directives": []
}
}
}
],
"kind": "const"
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -32,7 +32,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}},
"name": "T" "name": {
"type": "Identifier",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -32,7 +32,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}}, "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20}},
"name": "T" "name": {
"type": "Identifier",
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,2 @@
declare function f(): void;
declare function f<T>(): T;

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,71 @@
{
"type": "File",
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}},
"program": {
"type": "Program",
"start":0,"end":55,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":27}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSDeclareFunction",
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
"declare": true,
"id": {
"type": "Identifier",
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"},
"name": "f"
},
"generator": false,
"async": false,
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":20,"end":26,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":26}},
"typeAnnotation": {
"type": "TSVoidKeyword",
"start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}}
}
}
},
{
"type": "TSDeclareFunction",
"start":28,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}},
"declare": true,
"id": {
"type": "Identifier",
"start":45,"end":46,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"f"},
"name": "f"
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":46,"end":49,"loc":{"start":{"line":2,"column":18},"end":{"line":2,"column":21}},
"params": [
{
"type": "TSTypeParameter",
"start":47,"end":48,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}},
"name": "T"
}
]
},
"params": [],
"returnType": {
"type": "TSTypeAnnotation",
"start":51,"end":54,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":26}},
"typeAnnotation": {
"type": "TSTypeReference",
"start":53,"end":54,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26}},
"typeName": {
"type": "Identifier",
"start":53,"end":54,"loc":{"start":{"line":2,"column":25},"end":{"line":2,"column":26},"identifierName":"T"},
"name": "T"
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -10,6 +10,7 @@
{ {
"type": "TSDeclareFunction", "type": "TSDeclareFunction",
"start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}}, "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":27}},
"declare": true,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"}, "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"},
@ -25,12 +26,12 @@
"type": "TSVoidKeyword", "type": "TSVoidKeyword",
"start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}} "start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}}
} }
}, }
"declare": true
}, },
{ {
"type": "TSDeclareFunction", "type": "TSDeclareFunction",
"start":28,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}}, "start":28,"end":55,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":27}},
"declare": true,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start":45,"end":46,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"f"}, "start":45,"end":46,"loc":{"start":{"line":2,"column":17},"end":{"line":2,"column":18},"identifierName":"f"},
@ -45,7 +46,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":47,"end":48,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}}, "start":47,"end":48,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}},
"name": "T" "name": {
"type": "Identifier",
"start":47,"end":48,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -62,8 +67,7 @@
"name": "T" "name": "T"
} }
} }
}, }
"declare": true
} }
], ],
"directives": [] "directives": []

View File

@ -0,0 +1 @@
interface I<T extends object = { x: number }> {}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,66 @@
{
"type": "File",
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}},
"program": {
"type": "Program",
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}},
"id": {
"type": "Identifier",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"I"},
"name": "I"
},
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":11,"end":45,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":45}},
"params": [
{
"type": "TSTypeParameter",
"start":12,"end":44,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":44}},
"name": "T",
"constraint": {
"type": "TSObjectKeyword",
"start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}}
},
"default": {
"type": "TSTypeLiteral",
"start":31,"end":44,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":44}},
"members": [
{
"type": "TSPropertySignature",
"start":33,"end":42,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":42}},
"key": {
"type": "Identifier",
"start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"},
"name": "x"
},
"computed": false,
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":34,"end":42,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":42}},
"typeAnnotation": {
"type": "TSNumberKeyword",
"start":36,"end":42,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":42}}
}
}
}
]
}
}
]
},
"body": {
"type": "TSInterfaceBody",
"start":46,"end":48,"loc":{"start":{"line":1,"column":46},"end":{"line":1,"column":48}},
"body": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -22,7 +22,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":12,"end":44,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":44}}, "start":12,"end":44,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":44}},
"name": "T", "name": {
"type": "Identifier",
"start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"T"},
"name": "T"
},
"constraint": { "constraint": {
"type": "TSObjectKeyword", "type": "TSObjectKeyword",
"start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}} "start":22,"end":28,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":28}}

View File

@ -0,0 +1,4 @@
interface Foo {
get foo<T>(): string;
set bar<T>(v);
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": false
}

View File

@ -0,0 +1,92 @@
{
"type": "File",
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"errors": [
"SyntaxError: An accessor cannot have type parameters. (2:10)",
"SyntaxError: An accessor cannot have type parameters. (3:10)"
],
"program": {
"type": "Program",
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "TSInterfaceDeclaration",
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
"id": {
"type": "Identifier",
"start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"Foo"},
"name": "Foo"
},
"body": {
"type": "TSInterfaceBody",
"start":14,"end":58,"loc":{"start":{"line":1,"column":14},"end":{"line":4,"column":1}},
"body": [
{
"type": "TSMethodSignature",
"start":18,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}},
"key": {
"type": "Identifier",
"start":22,"end":25,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":9},"identifierName":"foo"},
"name": "foo"
},
"computed": false,
"kind": "get",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":25,"end":28,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}},
"params": [
{
"type": "TSTypeParameter",
"start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}},
"name": "T"
}
]
},
"parameters": [],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start":30,"end":38,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}},
"typeAnnotation": {
"type": "TSStringKeyword",
"start":32,"end":38,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":22}}
}
}
},
{
"type": "TSMethodSignature",
"start":42,"end":56,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":16}},
"key": {
"type": "Identifier",
"start":46,"end":49,"loc":{"start":{"line":3,"column":6},"end":{"line":3,"column":9},"identifierName":"bar"},
"name": "bar"
},
"computed": false,
"kind": "set",
"typeParameters": {
"type": "TSTypeParameterDeclaration",
"start":49,"end":52,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":12}},
"params": [
{
"type": "TSTypeParameter",
"start":50,"end":51,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}},
"name": "T"
}
]
},
"parameters": [
{
"type": "Identifier",
"start":53,"end":54,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14},"identifierName":"v"},
"name": "v"
}
]
}
]
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"BABEL_8_BREAKING": true
}

View File

@ -40,7 +40,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}}, "start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}},
"name": "T" "name": {
"type": "Identifier",
"start":26,"end":27,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },
@ -71,7 +75,11 @@
{ {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start":50,"end":51,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}}, "start":50,"end":51,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11}},
"name": "T" "name": {
"type": "Identifier",
"start":50,"end":51,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":11},"identifierName":"T"},
"name": "T"
}
} }
] ]
}, },

View File

@ -0,0 +1,3 @@
interface I {
m<T extends object = { x: number }>(): T;
}

Some files were not shown because too many files have changed in this diff Show More