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

Commit 30d64ec

Browse files
committed
Breaking: Updated supported TypeScript version to ~2.2.1 (fixes #149)
1 parent 25207e0 commit 30d64ec

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est
66

77
## Supported TypeScript Version
88

9-
The version of TypeScript supported by this parser is `2.0.x`. Please ensure that you are using this version before submitting any issues.
9+
The version of TypeScript supported by this parser is `~2.2.1`. This is reflected in the `peerDependency` requirement within the package.json file.
1010

11-
Due to a bug in the TypeScript Compiler it was not possible to officially support TypeScript `2.1.x`, please see this issue for more details on using `2.1.x`: https://github.com/eslint/typescript-eslint-parser/issues/149
11+
**Please ensure that you are using this version before submitting any issues.**
1212

1313
## Usage
1414

lib/ast-converter.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ module.exports = function(ast, extra) {
680680
function deeplyCopy() {
681681
result.type = "TS" + SyntaxKind[node.kind];
682682
Object.keys(node).filter(function(key) {
683-
return !(/^(?:kind|parent|pos|end|flags)$/.test(key));
683+
return !(/^(?:kind|parent|pos|end|flags|modifierFlagsCache)$/.test(key));
684684
}).forEach(function(key) {
685685
if (key === "type") {
686686
result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null;
@@ -1083,7 +1083,7 @@ module.exports = function(ast, extra) {
10831083
key: convertChild(node.name),
10841084
value: convertChild(node.initializer),
10851085
computed: (node.name.kind === SyntaxKind.ComputedPropertyName),
1086-
static: Boolean(node.flags & ts.NodeFlags.Static),
1086+
static: Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static),
10871087
accessibility: getTSNodeAccessibility(node),
10881088
decorators: (node.decorators) ? node.decorators.map(function(d) {
10891089
return convertChild(d.expression);
@@ -1166,7 +1166,7 @@ module.exports = function(ast, extra) {
11661166
key: convertChild(node.name),
11671167
value: method,
11681168
computed: isMethodNameComputed,
1169-
static: Boolean(node.flags & ts.NodeFlags.Static),
1169+
static: Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static),
11701170
kind: "method",
11711171
accessibility: getTSNodeAccessibility(node),
11721172
decorators: (node.decorators) ? node.decorators.map(function(d) {
@@ -1188,7 +1188,7 @@ module.exports = function(ast, extra) {
11881188
// TypeScript uses this even for static methods named "constructor"
11891189
case SyntaxKind.Constructor:
11901190

1191-
var constructorIsStatic = Boolean(node.flags & ts.NodeFlags.Static),
1191+
var constructorIsStatic = Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static),
11921192
firstConstructorToken = constructorIsStatic ? ts.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(),
11931193
constructorLoc = ast.getLineAndCharacterOfPosition(node.parameters.pos - 1),
11941194
constructor = {
@@ -1441,8 +1441,8 @@ module.exports = function(ast, extra) {
14411441

14421442
// Patterns
14431443

1444-
// Note: TypeScript uses this for both spread and rest expressions
1445-
case SyntaxKind.SpreadElementExpression:
1444+
case SyntaxKind.SpreadElement:
1445+
case SyntaxKind.SpreadAssignment:
14461446
assign(result, {
14471447
type: "SpreadElement",
14481448
argument: convertChild(node.expression)

package.json

+2-2
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.0.3"
33+
"typescript": "~2.2.1"
3434
},
3535
"keywords": [
3636
"ast",
@@ -55,6 +55,6 @@
5555
"object-assign": "^4.0.1"
5656
},
5757
"peerDependencies": {
58-
"typescript": "~2.0.3"
58+
"typescript": "~2.2.1"
5959
}
6060
}

0 commit comments

Comments
 (0)