feat(typescript): support definite assignment (`!:`) (#4020)
parent
d298c51cba
commit
8f6a32853c
|
@ -35,6 +35,7 @@
|
||||||
"globby": "6.1.0",
|
"globby": "6.1.0",
|
||||||
"graphql": "0.12.3",
|
"graphql": "0.12.3",
|
||||||
"gray-matter": "3.1.1",
|
"gray-matter": "3.1.1",
|
||||||
|
"html-tag-names": "1.1.1",
|
||||||
"ignore": "3.3.7",
|
"ignore": "3.3.7",
|
||||||
"jest-docblock": "22.2.2",
|
"jest-docblock": "22.2.2",
|
||||||
"json-stable-stringify": "1.0.1",
|
"json-stable-stringify": "1.0.1",
|
||||||
|
@ -54,9 +55,8 @@
|
||||||
"resolve": "1.5.0",
|
"resolve": "1.5.0",
|
||||||
"semver": "5.4.1",
|
"semver": "5.4.1",
|
||||||
"string-width": "2.1.1",
|
"string-width": "2.1.1",
|
||||||
"html-tag-names": "1.1.1",
|
|
||||||
"typescript": "2.7.0-insiders.20171214",
|
"typescript": "2.7.0-insiders.20171214",
|
||||||
"typescript-eslint-parser": "13.0.0",
|
"typescript-eslint-parser": "14.0.0",
|
||||||
"unicode-regex": "1.0.1",
|
"unicode-regex": "1.0.1",
|
||||||
"unified": "6.1.6"
|
"unified": "6.1.6"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3214,7 +3214,7 @@ function printTypeAnnotation(path, options, print) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return concat([
|
return concat([
|
||||||
isFunctionDeclarationIdentifier ? "" : ": ",
|
isFunctionDeclarationIdentifier ? "" : node.definite ? "!: " : ": ",
|
||||||
path.call(print, "typeAnnotation")
|
path.call(print, "typeAnnotation")
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`definite.ts 1`] = `
|
||||||
|
class MyComponent {
|
||||||
|
ngModel!: ng.INgModelController;
|
||||||
|
}
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
class MyComponent {
|
||||||
|
ngModel!: ng.INgModelController;
|
||||||
|
}
|
||||||
|
|
||||||
|
`;
|
|
@ -0,0 +1,3 @@
|
||||||
|
class MyComponent {
|
||||||
|
ngModel!: ng.INgModelController;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
run_spec(__dirname, ["typescript"]);
|
|
@ -4579,9 +4579,9 @@ typedarray@^0.0.6:
|
||||||
version "0.0.6"
|
version "0.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||||
|
|
||||||
typescript-eslint-parser@13.0.0:
|
typescript-eslint-parser@14.0.0:
|
||||||
version "13.0.0"
|
version "14.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-13.0.0.tgz#57f9be603d0fad7c26da76c2be67c0779d23362c"
|
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-14.0.0.tgz#c90a8f541c1d96e5c55e2807c61d154e788520f9"
|
||||||
dependencies:
|
dependencies:
|
||||||
lodash.unescape "4.0.1"
|
lodash.unescape "4.0.1"
|
||||||
semver "5.5.0"
|
semver "5.5.0"
|
||||||
|
|
Loading…
Reference in New Issue