TypeScript: temp fix for missing readonly keyword (#1865)

* fix(typescript): temp fix for missing readonly keyword, fixes #1845

* fix(typescript): use non-master commit from tsep
master
Lucas Azzola 2017-06-03 01:09:24 +10:00 committed by Christopher Chedeau
parent 8511e798dc
commit 38eec13a03
8 changed files with 27 additions and 7 deletions

View File

@ -42,7 +42,7 @@
"rollup-plugin-node-resolve": "2.0.0",
"rollup-plugin-replace": "1.1.1",
"typescript": "2.3.2",
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#3dcba7d53f61f51069ed84b57e053802c014d703",
"typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#32634f10b8c9bc4622762867d9d00e79ea1092fe",
"uglify-es": "mishoo/UglifyJS2#harmony",
"webpack": "2.6.1"
},

View File

@ -1674,6 +1674,9 @@ function genericPrintNoParens(path, options, print, args) {
if (n.type === "TSAbstractClassProperty") {
parts.push("abstract ");
}
if (n.readonly) {
parts.push("readonly ");
}
if (n.computed) {
parts.push("[", path.call(print, "key"), "]");
} else {
@ -2237,6 +2240,7 @@ function genericPrintNoParens(path, options, print, args) {
if (n.static) {
parts.push("static ");
}
if (n.readonly) {
parts.push("readonly ");
}

View File

@ -413,7 +413,7 @@ class C {
constructor(readonly readonly y: number) {}
}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class C {
x: number;
readonly x: number;
constructor(readonly y: number) {}
}

View File

@ -11,7 +11,7 @@ export class ViewTokensChangedEvent {
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export class ViewTokensChangedEvent {
public ranges: {
public readonly ranges: {
/**
* Start line number of range
*/

View File

@ -0,0 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`readonly.ts 1`] = `
class Foo {
public readonly foo = 'string';
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Foo {
public readonly foo = "string";
}
`;

View File

@ -0,0 +1 @@
run_spec(__dirname, { parser: "typescript" });

View File

@ -0,0 +1,3 @@
class Foo {
public readonly foo = 'string';
}

View File

@ -1293,7 +1293,7 @@ glob-parent@^2.0.0:
dependencies:
is-glob "^2.0.0"
glob@7.1.1, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1:
glob@7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
dependencies:
@ -1304,7 +1304,7 @@ glob@7.1.1, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@7.1.2:
glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
@ -3251,9 +3251,9 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#3dcba7d53f61f51069ed84b57e053802c014d703":
"typescript-eslint-parser@git://github.com/eslint/typescript-eslint-parser.git#32634f10b8c9bc4622762867d9d00e79ea1092fe":
version "3.0.0"
resolved "git://github.com/eslint/typescript-eslint-parser.git#3dcba7d53f61f51069ed84b57e053802c014d703"
resolved "git://github.com/eslint/typescript-eslint-parser.git#32634f10b8c9bc4622762867d9d00e79ea1092fe"
dependencies:
lodash.unescape "4.0.1"
semver "5.3.0"