Skip to content

Commit 9571ab0

Browse files
committed
Breaking: Support unique symbol (fixes eslint#426)
1 parent e94ede3 commit 9571ab0

File tree

7 files changed

+481
-1
lines changed

7 files changed

+481
-1
lines changed

Diff for: lib/ast-node-types.js

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ module.exports = {
141141
TSSymbolKeyword: "TSSymbolKeyword",
142142
TSTypeAnnotation: "TSTypeAnnotation",
143143
TSTypeLiteral: "TSTypeLiteral",
144+
TSTypeOperator: "TSTypeOperator",
144145
TSTypeParameter: "TSTypeParameter",
145146
TSTypeParameterDeclaration: "TSTypeParameterDeclaration",
146147
TSTypeParameterInstantiation: "TSTypeParameterInstantiation",

Diff for: lib/convert.js

+9
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,15 @@ module.exports = function convert(config) {
15711571
});
15721572
break;
15731573

1574+
case SyntaxKind.TypeOperator:
1575+
Object.assign(result, {
1576+
type: AST_NODE_TYPES.TSTypeOperator,
1577+
operator: nodeUtils.getTextForTokenKind(node.operator),
1578+
prefix: true,
1579+
argument: convertChild(node.type)
1580+
});
1581+
break;
1582+
15741583
// Binary Operations
15751584

15761585
case SyntaxKind.BinaryExpression:

Diff for: lib/node-utils.js

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|=";
9797
TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^=";
9898
TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@";
9999
TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in";
100+
TOKEN_TO_TEXT[SyntaxKind.UniqueKeyword] = "unique";
101+
TOKEN_TO_TEXT[SyntaxKind.KeyOfKeyword] = "keyof";
100102

101103
/**
102104
* Find the first matching child based on the given sourceFile and predicate function.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"npm-license": "0.3.3",
3232
"shelljs": "0.7.8",
3333
"shelljs-nodecli": "0.1.1",
34-
"typescript": "~2.6.1"
34+
"typescript": "2.7.0-insiders.20180108"
3535
},
3636
"keywords": [
3737
"ast",
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
type x = keyof foo;
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
type A = unique symbol;

0 commit comments

Comments
 (0)