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

Breaking: Support TypeScript 2.9 #480

Merged
merged 4 commits into from
Jun 4, 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: 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.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.
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.

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

Expand Down
6 changes: 6 additions & 0 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,9 @@ module.exports = function convert(config) {
case SyntaxKind.TaggedTemplateExpression:
Object.assign(result, {
type: AST_NODE_TYPES.TaggedTemplateExpression,
typeParameters: (node.typeArguments)
? convertTypeArgumentsToTypeParameters(node.typeArguments)
: undefined,
tag: convertChild(node.tag),
quasi: convertChild(node.template)
});
Expand Down Expand Up @@ -1856,6 +1859,9 @@ module.exports = function convert(config) {
case SyntaxKind.JsxOpeningElement:
Object.assign(result, {
type: AST_NODE_TYPES.JSXOpeningElement,
typeParameters: (node.typeArguments)
? convertTypeArgumentsToTypeParameters(node.typeArguments)
: undefined,
selfClosing: false,
name: convertTypeScriptJSXTagNameToESTreeName(node.tagName),
attributes: node.attributes.properties.map(convertChild)
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.8.1",
"shelljs-nodecli": "0.1.1",
"typescript": "~2.8.1"
"typescript": "~2.9.1"
},
"keywords": [
"ast",
Expand Down
16 changes: 14 additions & 2 deletions tests/ast-alignment/fixtures-to-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,11 @@ let fixturePatternConfigsToTest = [
/**
* AST difference
*/
"react-typed-props"
"react-typed-props",
/**
* currently babylon not supported
*/
"generic-jsx-element"
]
}),

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

createFixturePatternConfigFor("typescript/expressions", { fileType: "ts" }),
createFixturePatternConfigFor("typescript/expressions", {
fileType: "ts",
ignore: [
/**
* currently babylon not supported
*/
"tagged-template-expression-type-arguments"
]
}),

createFixturePatternConfigFor("typescript/errorRecovery", {
fileType: "ts",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/tsx/generic-jsx-element.src.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<MyComponent<number> data={12} />
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo<bar>`baz`;
Loading