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

Commit

Permalink
Breaking: always set optional on ClassProperty (fixes #472) (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang authored and JamesHenry committed Jun 27, 2018
1 parent 3c874ec commit 11d9169
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ module.exports = function convert(config) {
}

if (node.name.kind === SyntaxKind.Identifier && node.questionToken) {
result.key.optional = true;
result.optional = true;
}

if (node.exclamationToken) {
Expand Down
2 changes: 0 additions & 2 deletions tests/ast-alignment/fixtures-to-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ let fixturePatternConfigsToTest = [
"type-alias-declaration",
"type-alias-object-without-annotation",
"typed-this",
"class-with-optional-properties",
"class-with-optional-property-undefined",
"export-type-function-declaration",
"export-type-class-declaration",
"abstract-interface",
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/__snapshots__/typescript.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13337,7 +13337,6 @@ Object {
},
},
"name": "foo",
"optional": true,
"range": Array [
14,
17,
Expand All @@ -13354,6 +13353,7 @@ Object {
"line": 2,
},
},
"optional": true,
"range": Array [
14,
19,
Expand All @@ -13376,7 +13376,6 @@ Object {
},
},
"name": "bar",
"optional": true,
"range": Array [
22,
25,
Expand All @@ -13393,6 +13392,7 @@ Object {
"line": 3,
},
},
"optional": true,
"range": Array [
22,
36,
Expand Down Expand Up @@ -13450,7 +13450,6 @@ Object {
},
},
"name": "baz",
"optional": true,
"range": Array [
47,
50,
Expand All @@ -13467,6 +13466,7 @@ Object {
"line": 4,
},
},
"optional": true,
"range": Array [
39,
61,
Expand Down Expand Up @@ -13928,7 +13928,6 @@ Object {
},
},
"name": "foo",
"optional": true,
"range": Array [
20,
23,
Expand All @@ -13945,6 +13944,7 @@ Object {
"line": 2,
},
},
"optional": true,
"range": Array [
12,
37,
Expand Down

0 comments on commit 11d9169

Please sign in to comment.