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

Breaking: Support unique symbol (fixes #426) #433

Merged
merged 1 commit into from
Feb 9, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ast-node-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ module.exports = {
TSSymbolKeyword: "TSSymbolKeyword",
TSTypeAnnotation: "TSTypeAnnotation",
TSTypeLiteral: "TSTypeLiteral",
TSTypeOperator: "TSTypeOperator",
TSTypeParameter: "TSTypeParameter",
TSTypeParameterDeclaration: "TSTypeParameterDeclaration",
TSTypeParameterInstantiation: "TSTypeParameterInstantiation",
Expand Down
8 changes: 8 additions & 0 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,14 @@ module.exports = function convert(config) {
});
break;

case SyntaxKind.TypeOperator:
Object.assign(result, {
type: AST_NODE_TYPES.TSTypeOperator,
operator: nodeUtils.getTextForTokenKind(node.operator),
typeAnnotation: convertChild(node.type)
});
break;

// Binary Operations

case SyntaxKind.BinaryExpression:
Expand Down
2 changes: 2 additions & 0 deletions lib/node-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|=";
TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^=";
TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@";
TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in";
TOKEN_TO_TEXT[SyntaxKind.UniqueKeyword] = "unique";
TOKEN_TO_TEXT[SyntaxKind.KeyOfKeyword] = "keyof";

/**
* Find the first matching child based on the given sourceFile and predicate function.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"npm-license": "0.3.3",
"shelljs": "0.7.8",
"shelljs-nodecli": "0.1.1",
"typescript": "~2.6.1"
"typescript": "2.7.0-insiders.20180108"
},
"keywords": [
"ast",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/typescript/basics/keyof-operator.src.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type x = keyof foo;
1 change: 1 addition & 0 deletions tests/fixtures/typescript/basics/unique-symbol.src.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type A = unique symbol;
Loading