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

Breaking: Support TypeScript 2.7 (fixes #442,#426) #447

Merged
merged 4 commits 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
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js
sudo: false
node_js:
- "4"
- "5"
- "6"
- "7"
- "8"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A parser that converts TypeScript source code into an [ESTree](https://github.co

We will always endeavor to support the latest stable version of TypeScript.

The version of TypeScript currently supported by this parser is `~2.6.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
The version of TypeScript currently supported by this parser is `~2.7.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.

If you use a non-supported version of TypeScript, the parser will log a warning to the console.

Expand Down
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 @@ -1573,6 +1573,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
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"license": "BSD-2-Clause",
"devDependencies": {
"babel-code-frame": "6.26.0",
"babylon": "7.0.0-beta.34",
"babylon": "7.0.0-beta.39",
"dedent": "0.7.0",
"eslint": "4.13.1",
"eslint": "4.17.0",
"eslint-config-eslint": "4.0.0",
"eslint-plugin-node": "5.2.1",
"eslint-plugin-node": "6.0.0",
"eslint-release": "0.10.3",
"glob": "7.1.2",
"jest": "21.2.1",
"jest": "22.2.1",
"lodash.isplainobject": "4.0.6",
"npm-license": "0.3.3",
"shelljs": "0.7.8",
"shelljs": "0.8.1",
"shelljs-nodecli": "0.1.1",
"typescript": "~2.6.1"
"typescript": "~2.7.1"
},
"keywords": [
"ast",
Expand All @@ -56,7 +56,7 @@
},
"dependencies": {
"lodash.unescape": "4.0.1",
"semver": "5.4.1"
"semver": "5.5.0"
},
"peerDependencies": {
"typescript": "*"
Expand Down
2 changes: 2 additions & 0 deletions tests/ast-alignment/fixtures-to-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ let fixturePatternConfigsToTest = [
"export-type-class-declaration",
"abstract-interface",
"export-type-alias-declaration",
"unique-symbol",
"keyof-operator",
/**
* tsep bug - Program.body[0].expression.left.properties[0].value.right is currently showing up
* as `ArrayPattern`, babylon, acorn and espree say it should be `ArrayExpression`
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