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

Commit efa6968

Browse files
committed
Breaking: Support TypeScript 2.3 (fixes #232)
1 parent 9397c5c commit efa6968

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est
88

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

11-
The version of TypeScript currently supported by this parser is `~2.2.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.
11+
The version of TypeScript currently supported by this parser is `~2.3.2`. 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.
1212

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

lib/ast-converter.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1943,11 +1943,14 @@ module.exports = function(ast, extra) {
19431943

19441944
case SyntaxKind.JsxOpeningElement:
19451945
var openingTagName = convertTypeScriptJSXTagNameToESTreeName(node.tagName);
1946+
// TypeScript 2.3 changed from `node.attributes` to `node.attributes.properties`.
1947+
// Use whichever is an array.
1948+
var attributes = Array.isArray(node.attributes) ? node.attributes : node.attributes.properties;
19461949
assign(result, {
19471950
type: "JSXOpeningElement",
19481951
selfClosing: false,
19491952
name: openingTagName,
1950-
attributes: node.attributes.map(convertChild)
1953+
attributes: attributes.map(convertChild)
19511954
});
19521955

19531956
break;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"semver": "^4.1.1",
3131
"shelljs": "^0.3.0",
3232
"shelljs-nodecli": "^0.1.1",
33-
"typescript": "~2.2.1"
33+
"typescript": "~2.3.2"
3434
},
3535
"keywords": [
3636
"ast",

0 commit comments

Comments
 (0)