babel-parser: typescript: add missing bigint keyword (#9230)

This commit is contained in:
Armano 2018-12-23 00:18:32 +01:00 committed by Brian Ng
parent d1aa665657
commit b5177ce290
4 changed files with 91 additions and 6 deletions

View File

@ -45,6 +45,8 @@ function keywordTypeFromName(
return "TSAnyKeyword"; return "TSAnyKeyword";
case "boolean": case "boolean":
return "TSBooleanKeyword"; return "TSBooleanKeyword";
case "bigint":
return "TSBigIntKeyword";
case "never": case "never":
return "TSNeverKeyword"; return "TSNeverKeyword";
case "number": case "number":

View File

@ -1157,6 +1157,7 @@ export type TsKeywordTypeType =
| "TSNumberKeyword" | "TSNumberKeyword"
| "TSObjectKeyword" | "TSObjectKeyword"
| "TSBooleanKeyword" | "TSBooleanKeyword"
| "TSBigIntKeyword"
| "TSStringKeyword" | "TSStringKeyword"
| "TSSymbolKeyword" | "TSSymbolKeyword"
| "TSVoidKeyword" | "TSVoidKeyword"

View File

@ -9,3 +9,4 @@ let st: string;
let sy: symbol; let sy: symbol;
let u: undefined; let u: undefined;
let v: void; let v: void;
let n: bigint;

View File

@ -1,29 +1,29 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 169, "end": 184,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 0 "column": 0
}, },
"end": { "end": {
"line": 11, "line": 12,
"column": 12 "column": 14
} }
}, },
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 169, "end": 184,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 0 "column": 0
}, },
"end": { "end": {
"line": 11, "line": 12,
"column": 12 "column": 14
} }
}, },
"sourceType": "module", "sourceType": "module",
@ -919,6 +919,87 @@
} }
], ],
"kind": "let" "kind": "let"
},
{
"type": "VariableDeclaration",
"start": 170,
"end": 184,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 12,
"column": 14
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 174,
"end": 183,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 13
}
},
"id": {
"type": "Identifier",
"start": 174,
"end": 183,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "n"
},
"name": "n",
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 175,
"end": 183,
"loc": {
"start": {
"line": 12,
"column": 5
},
"end": {
"line": 12,
"column": 13
}
},
"typeAnnotation": {
"type": "TSBigIntKeyword",
"start": 177,
"end": 183,
"loc": {
"start": {
"line": 12,
"column": 7
},
"end": {
"line": 12,
"column": 13
}
}
}
}
},
"init": null
}
],
"kind": "let"
} }
], ],
"directives": [] "directives": []