Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

fix: add missing keywords to ast-node-types #56

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ast-node-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const AST_NODE_TYPES: { [key: string]: string } = {
TSArrayType: 'TSArrayType',
TSAsyncKeyword: 'TSAsyncKeyword',
TSBooleanKeyword: 'TSBooleanKeyword',
TSBigIntKeyword: 'TSBigIntKeyword',
TSConstructorType: 'TSConstructorType',
TSConstructSignature: 'TSConstructSignature',
TSDeclareKeyword: 'TSDeclareKeyword',
Expand Down
1 change: 1 addition & 0 deletions src/node-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ function isTypeKeyword(kind: number): boolean {
switch (kind) {
case SyntaxKind.AnyKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.BigIntKeyword:
case SyntaxKind.NeverKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.ObjectKeyword:
Expand Down
20 changes: 19 additions & 1 deletion tests/ast-alignment/fixtures-to-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,25 @@ let fixturePatternConfigsToTest = [
* Not yet supported in Babylon https://github.com/babel/babel/issues/7749
*/
'import-type',
'import-type-with-type-parameters-in-type-reference'
'import-type-with-type-parameters-in-type-reference',
/**
* babel is not supporting it yet https://github.com/babel/babel/pull/9230
* Babel: TSTypeReference -> Identifier
* tsep: TSBigIntKeyword
*/
'typed-keyword-bigint',
/**
* Awaiting feedback on Babel issue https://github.com/babel/babel/issues/9228
* Babel: BooleanLiteral
* tsep: Literal
*/
'typed-keyword-true',
/**
* Not yet supported in Babel https://github.com/babel/babel/issues/9228
* Babel: BooleanLiteral
* tsep: Literal
*/
'typed-keyword-false'
],
parseWithSourceTypeModule: [
'export-named-enum',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = bigint
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = boolean
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = never
1 change: 1 addition & 0 deletions tests/fixtures/typescript/basics/typed-keyword-null.src.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = number
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = object
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = string
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = symbol
1 change: 1 addition & 0 deletions tests/fixtures/typescript/basics/typed-keyword-true.src.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = true
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = undefined
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = unknown
1 change: 1 addition & 0 deletions tests/fixtures/typescript/basics/typed-keyword-void.src.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type Foo = void
Loading