From 2fc78133e3e31696834144d6f8e16afdc76ccc4e Mon Sep 17 00:00:00 2001 From: Ika Date: Wed, 27 Jun 2018 14:31:33 +0800 Subject: [PATCH 1/2] fix: ClassProperty#optional --- lib/convert.js | 2 +- tests/ast-alignment/fixtures-to-test.js | 2 -- tests/lib/__snapshots__/typescript.js.snap | 8 ++++---- 3 files changed, 5 insertions(+), 7 deletions(-) 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, From f8b2da12736c5a2e04f346ff086dcfacf4a18ca5 Mon Sep 17 00:00:00 2001 From: Ika Date: Wed, 27 Jun 2018 14:32:22 +0800 Subject: [PATCH 2/2] chore: trigger commit-message validation