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

Commit 9316b23

Browse files
authored
Breaking: Support TypeScript 2.9 (#480)
* New: support TaggedTemplateExpression typeArguments (#469) * New: support generic JSX element (fixes #462) (#461) * Chore: Set latest TS version
1 parent a748eae commit 9316b23

File tree

8 files changed

+727
-4
lines changed

8 files changed

+727
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A parser that converts TypeScript source code into an [ESTree](https://github.co
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.8.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.9.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.
1212

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

lib/convert.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,9 @@ module.exports = function convert(config) {
12371237
case SyntaxKind.TaggedTemplateExpression:
12381238
Object.assign(result, {
12391239
type: AST_NODE_TYPES.TaggedTemplateExpression,
1240+
typeParameters: (node.typeArguments)
1241+
? convertTypeArgumentsToTypeParameters(node.typeArguments)
1242+
: undefined,
12401243
tag: convertChild(node.tag),
12411244
quasi: convertChild(node.template)
12421245
});
@@ -1856,6 +1859,9 @@ module.exports = function convert(config) {
18561859
case SyntaxKind.JsxOpeningElement:
18571860
Object.assign(result, {
18581861
type: AST_NODE_TYPES.JSXOpeningElement,
1862+
typeParameters: (node.typeArguments)
1863+
? convertTypeArgumentsToTypeParameters(node.typeArguments)
1864+
: undefined,
18591865
selfClosing: false,
18601866
name: convertTypeScriptJSXTagNameToESTreeName(node.tagName),
18611867
attributes: node.attributes.properties.map(convertChild)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"npm-license": "0.3.3",
3232
"shelljs": "0.8.1",
3333
"shelljs-nodecli": "0.1.1",
34-
"typescript": "~2.8.1"
34+
"typescript": "~2.9.1"
3535
},
3636
"keywords": [
3737
"ast",

tests/ast-alignment/fixtures-to-test.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ let fixturePatternConfigsToTest = [
324324
/**
325325
* AST difference
326326
*/
327-
"react-typed-props"
327+
"react-typed-props",
328+
/**
329+
* currently babylon not supported
330+
*/
331+
"generic-jsx-element"
328332
]
329333
}),
330334

@@ -439,7 +443,15 @@ let fixturePatternConfigsToTest = [
439443
createFixturePatternConfigFor("typescript/decorators/parameter-decorators", { fileType: "ts" }),
440444
createFixturePatternConfigFor("typescript/decorators/property-decorators", { fileType: "ts" }),
441445

442-
createFixturePatternConfigFor("typescript/expressions", { fileType: "ts" }),
446+
createFixturePatternConfigFor("typescript/expressions", {
447+
fileType: "ts",
448+
ignore: [
449+
/**
450+
* currently babylon not supported
451+
*/
452+
"tagged-template-expression-type-arguments"
453+
]
454+
}),
443455

444456
createFixturePatternConfigFor("typescript/errorRecovery", {
445457
fileType: "ts",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<MyComponent<number> data={12} />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo<bar>`baz`;

0 commit comments

Comments
 (0)