Skip to content

Commit 7c3eaf2

Browse files
committed
New: Support Definite Assignment (Fixes eslint#424)
1 parent e94ede3 commit 7c3eaf2

File tree

6 files changed

+4141
-1
lines changed

6 files changed

+4141
-1
lines changed

lib/convert.js

+8
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,10 @@ module.exports = function convert(config) {
658658
init: convertChild(node.initializer)
659659
});
660660

661+
if (node.exclamationToken) {
662+
result.exclamationToken = true;
663+
}
664+
661665
if (node.type) {
662666
result.id.typeAnnotation = convertTypeAnnotation(node.type);
663667
fixTypeAnnotationParentLocation(result.id);
@@ -859,6 +863,10 @@ module.exports = function convert(config) {
859863
result.key.optional = true;
860864
}
861865

866+
if (node.exclamationToken) {
867+
result.exclamationToken = true;
868+
}
869+
862870
if (result.key.type === AST_NODE_TYPES.Literal && node.questionToken) {
863871
result.optional = true;
864872
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"npm-license": "0.3.3",
3232
"shelljs": "0.7.8",
3333
"shelljs-nodecli": "0.1.1",
34-
"typescript": "~2.6.1"
34+
"typescript": "^2.7.0-insiders.20180108"
3535
},
3636
"keywords": [
3737
"ast",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class X {
2+
a!: string;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const x!: string;
2+
var y!: number;
3+
let z!: object;

0 commit comments

Comments
 (0)