diff --git a/lib/convert.js b/lib/convert.js index 18d52cd..8176c5e 100644 --- a/lib/convert.js +++ b/lib/convert.js @@ -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) { diff --git a/tests/ast-alignment/fixtures-to-test.js b/tests/ast-alignment/fixtures-to-test.js index c4ba689..9af8d16 100644 --- a/tests/ast-alignment/fixtures-to-test.js +++ b/tests/ast-alignment/fixtures-to-test.js @@ -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", diff --git a/tests/lib/__snapshots__/typescript.js.snap b/tests/lib/__snapshots__/typescript.js.snap index 176b601..9424f52 100644 --- a/tests/lib/__snapshots__/typescript.js.snap +++ b/tests/lib/__snapshots__/typescript.js.snap @@ -13337,7 +13337,6 @@ Object { }, }, "name": "foo", - "optional": true, "range": Array [ 14, 17, @@ -13354,6 +13353,7 @@ Object { "line": 2, }, }, + "optional": true, "range": Array [ 14, 19, @@ -13376,7 +13376,6 @@ Object { }, }, "name": "bar", - "optional": true, "range": Array [ 22, 25, @@ -13393,6 +13392,7 @@ Object { "line": 3, }, }, + "optional": true, "range": Array [ 22, 36, @@ -13450,7 +13450,6 @@ Object { }, }, "name": "baz", - "optional": true, "range": Array [ 47, 50, @@ -13467,6 +13466,7 @@ Object { "line": 4, }, }, + "optional": true, "range": Array [ 39, 61, @@ -13928,7 +13928,6 @@ Object { }, }, "name": "foo", - "optional": true, "range": Array [ 20, 23, @@ -13945,6 +13944,7 @@ Object { "line": 2, }, }, + "optional": true, "range": Array [ 12, 37,