Skip to content

Commit 02f1e48

Browse files
committed
New: Support Definite Assignment (fixes eslint#424)
1 parent e1c6b33 commit 02f1e48

File tree

4 files changed

+951
-0
lines changed

4 files changed

+951
-0
lines changed

lib/convert.js

Lines changed: 8 additions & 0 deletions
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
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class X {
2+
a!: string;
3+
}
Lines changed: 3 additions & 0 deletions
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)