Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 11d9169

Browse files
ikatyangJamesHenry
authored andcommitted
Breaking: always set optional on ClassProperty (fixes #472) (#491)
1 parent 3c874ec commit 11d9169

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

lib/convert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ module.exports = function convert(config) {
860860
}
861861

862862
if (node.name.kind === SyntaxKind.Identifier && node.questionToken) {
863-
result.key.optional = true;
863+
result.optional = true;
864864
}
865865

866866
if (node.exclamationToken) {

tests/ast-alignment/fixtures-to-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,6 @@ let fixturePatternConfigsToTest = [
399399
"type-alias-declaration",
400400
"type-alias-object-without-annotation",
401401
"typed-this",
402-
"class-with-optional-properties",
403-
"class-with-optional-property-undefined",
404402
"export-type-function-declaration",
405403
"export-type-class-declaration",
406404
"abstract-interface",

tests/lib/__snapshots__/typescript.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13337,7 +13337,6 @@ Object {
1333713337
},
1333813338
},
1333913339
"name": "foo",
13340-
"optional": true,
1334113340
"range": Array [
1334213341
14,
1334313342
17,
@@ -13354,6 +13353,7 @@ Object {
1335413353
"line": 2,
1335513354
},
1335613355
},
13356+
"optional": true,
1335713357
"range": Array [
1335813358
14,
1335913359
19,
@@ -13376,7 +13376,6 @@ Object {
1337613376
},
1337713377
},
1337813378
"name": "bar",
13379-
"optional": true,
1338013379
"range": Array [
1338113380
22,
1338213381
25,
@@ -13393,6 +13392,7 @@ Object {
1339313392
"line": 3,
1339413393
},
1339513394
},
13395+
"optional": true,
1339613396
"range": Array [
1339713397
22,
1339813398
36,
@@ -13450,7 +13450,6 @@ Object {
1345013450
},
1345113451
},
1345213452
"name": "baz",
13453-
"optional": true,
1345413453
"range": Array [
1345513454
47,
1345613455
50,
@@ -13467,6 +13466,7 @@ Object {
1346713466
"line": 4,
1346813467
},
1346913468
},
13469+
"optional": true,
1347013470
"range": Array [
1347113471
39,
1347213472
61,
@@ -13928,7 +13928,6 @@ Object {
1392813928
},
1392913929
},
1393013930
"name": "foo",
13931-
"optional": true,
1393213931
"range": Array [
1393313932
20,
1393413933
23,
@@ -13945,6 +13944,7 @@ Object {
1394513944
"line": 2,
1394613945
},
1394713946
},
13947+
"optional": true,
1394813948
"range": Array [
1394913949
12,
1395013950
37,

0 commit comments

Comments
 (0)