Upgrade typescript to 2.4 (#2120)

Fixes #2117
master
Christopher Chedeau 2017-06-13 09:47:40 -07:00 committed by GitHub
parent 8dd0cb2a05
commit abfdbe1896
5 changed files with 21 additions and 32 deletions

View File

@ -45,8 +45,8 @@
"rollup-plugin-node-globals": "1.1.0",
"rollup-plugin-node-resolve": "2.0.0",
"rollup-plugin-replace": "1.1.1",
"typescript": "2.3.4",
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#806251524424e3ad91e750da0f76b8de25ed0b42",
"typescript": "2.4.0",
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#ts-2.4",
"uglify-es": "3.0.15",
"webpack": "2.6.1"
},

View File

@ -609,6 +609,9 @@ function genericPrintNoParens(path, options, print, args) {
}
return path.call(print, "id");
case "TSExportAssigment": {
return concat(["export = ", path.call(print, "expression"), semi]);
}
case "ExportDeclaration":
case "ExportDefaultDeclaration":
case "ExportNamedDeclaration":
@ -1569,11 +1572,6 @@ function genericPrintNoParens(path, options, print, args) {
return concat(parts);
case "JSXIdentifier":
// Can be removed when this is fixed:
// https://github.com/eslint/typescript-eslint-parser/issues/307
if (!n.name) {
return "this";
}
return "" + n.name;
case "JSXNamespacedName":
return join(":", [
@ -2118,6 +2116,7 @@ function genericPrintNoParens(path, options, print, args) {
}
case "NullableTypeAnnotation":
return concat(["?", path.call(print, "typeAnnotation")]);
case "TSNullKeyword":
case "NullLiteralTypeAnnotation":
return "null";
case "ThisTypeAnnotation":
@ -2492,13 +2491,9 @@ function genericPrintNoParens(path, options, print, args) {
return group(concat(parts));
case "TSNamespaceExportDeclaration":
if (n.declaration) {
// Temporary fix until https://github.com/eslint/typescript-eslint-parser/issues/263
const isDefault = options.originalText
.slice(util.locStart(n), util.locStart(n.declaration))
.match(/\bdefault\b/);
parts.push(
"export ",
isDefault ? "default " : "",
n.default ? "default " : "",
path.call(print, "declaration")
);
} else {
@ -3149,20 +3144,7 @@ function printExportDeclaration(path, options, print) {
const parts = ["export "];
if (decl["default"] || decl.type === "ExportDefaultDeclaration") {
// Temp fix, delete after https://github.com/eslint/typescript-eslint-parser/issues/304
if (
decl.declaration &&
/=/.test(
options.originalText.slice(
util.locStart(decl),
util.locStart(decl.declaration)
)
)
) {
parts.push("= ");
} else {
parts.push("default ");
}
parts.push("default ");
}
parts.push(
@ -4492,7 +4474,7 @@ function shouldHugType(node) {
n.type === "VoidTypeAnnotation" ||
n.type === "TSVoidKeyword" ||
n.type === "NullLiteralTypeAnnotation" ||
(n.type === "Literal" && n.value === null)
n.type === "TSNullKeyword"
).length;
const objectCount = node.types.filter(

View File

@ -1 +1 @@
run_spec(__dirname, { parser: "babylon" });
run_spec(__dirname, null, ["babylon", "typescript"]);

View File

@ -38,7 +38,7 @@ interface AudioBufferList {
class<T> implements Map<T> {}
interface AudioBufferList {
mBuffers: interop.Reference<any> /*AudioBuffer*/;
mBuffers: interop.Reference<any /*AudioBuffer*/>;
}
`;

View File

@ -3589,9 +3589,16 @@ typedarray@^0.0.6:
lodash.unescape "4.0.1"
semver "5.3.0"
typescript@2.3.4:
version "2.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.4.tgz#3d38321828231e434f287514959c37a82b629f42"
"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#ts-2.4":
version "3.0.0"
resolved "git://github.com/eslint/typescript-eslint-parser.git#fcfc9579a01a39df1cd79fbb8304c43564a5f23b"
dependencies:
lodash.unescape "4.0.1"
semver "5.3.0"
typescript@2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.0.tgz#aef5a8d404beba36ad339abf079ddddfffba86dd"
uglify-es@3.0.15:
version "3.0.15"