From 883e637fa9f625eb74f80ea813be29adb2e0212f Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Thu, 8 Jun 2017 09:25:28 -0700 Subject: [PATCH] Support the Keyword type (#2056) This is an issue in https://github.com/eslint/typescript-eslint-parser/issues/315 Fixes #2049 --- src/printer.js | 3 +++ tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap | 9 +++++++++ tests/typescript_tsx/keyword.tsx | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 tests/typescript_tsx/keyword.tsx diff --git a/src/printer.js b/src/printer.js index e8336fa57..e617415e5 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1625,6 +1625,9 @@ function genericPrintNoParens(path, options, print, args) { requiresHardline ? hardline : "" ]); } + case "Keyword": { + return n.name; + } case "TypeAnnotatedIdentifier": return concat([ path.call(print, "annotation"), diff --git a/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap index dcb1db90b..7198f12e3 100644 --- a/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_tsx/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`keyword.tsx 1`] = ` +; + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; +; + +`; + exports[`not-react.ts 1`] = ` /// diff --git a/tests/typescript_tsx/keyword.tsx b/tests/typescript_tsx/keyword.tsx new file mode 100644 index 000000000..473b78f58 --- /dev/null +++ b/tests/typescript_tsx/keyword.tsx @@ -0,0 +1,2 @@ +; +