Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port babel-parser changes from 2020-04-12 to 2020-07-22 #556

Merged
merged 8 commits into from
Oct 13, 2020
1 change: 1 addition & 0 deletions src/parser/plugins/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ function tsParseNonArrayType(): void {
return;
case tt.string:
case tt.num:
case tt.bigint:
case tt._true:
case tt._false:
parseLiteral();
Expand Down
15 changes: 15 additions & 0 deletions test/typescript-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,21 @@ describe("typescript transform", () => {
);
});

it("allows bigint literal syntax for type literals", () => {
assertTypeScriptResult(
`
let x: 10n;
type T = { n: 20n, m: -30n };
function f(arg: [40n]): 50n[] {};
`,
`"use strict";
let x;

function f(arg) {};
`,
);
});

it("allows private field syntax", () => {
assertTypeScriptResult(
`
Expand Down