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

TypeScript: reserve unknown as TSUnknownKeyword #8755

Merged
merged 1 commit into from Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/babel-generator/src/generators/typescript.js
Expand Up @@ -127,6 +127,9 @@ export function TSIndexSignature(node) {
export function TSAnyKeyword() {
this.word("any");
}
export function TSUnknownKeyword() {
this.word("unknown");
}
export function TSNumberKeyword() {
this.word("number");
}
Expand Down
@@ -1,4 +1,5 @@
let a: any;
let un: unknown;
let b: boolean;
let ne: never;
let nul: null;
Expand Down
@@ -1,4 +1,5 @@
let a: any;
let un: unknown;
let b: boolean;
let ne: never;
let nul: null;
Expand All @@ -7,4 +8,4 @@ let o: object;
let st: string;
let sy: symbol;
let u: undefined;
let v: void;
let v: void;
2 changes: 2 additions & 0 deletions packages/babel-parser/src/plugins/typescript.js
Expand Up @@ -57,6 +57,8 @@ function keywordTypeFromName(
return "TSSymbolKeyword";
case "undefined":
return "TSUndefinedKeyword";
case "unknown":
return "TSUnknownKeyword";
default:
return undefined;
}
Expand Down
1 change: 1 addition & 0 deletions packages/babel-parser/src/types.js
Expand Up @@ -1119,6 +1119,7 @@ export type TsTypeBase = NodeBase;

export type TsKeywordTypeType =
| "TSAnyKeyword"
| "TSUnknownKeyword"
| "TSNumberKeyword"
| "TSObjectKeyword"
| "TSBooleanKeyword"
Expand Down
@@ -1,4 +1,5 @@
let a: any;
let un: unknown;
let b: boolean;
let ne: never;
let nul: null;
Expand Down