diff --git a/src/typescript-ast-nodes.js b/src/typescript-ast-nodes.js index caf446c0a..55eeca52f 100644 --- a/src/typescript-ast-nodes.js +++ b/src/typescript-ast-nodes.js @@ -123,7 +123,10 @@ module.exports = function(fork) { .field("typeAnnotation", def("TypeAnnotation")) .bases("TSSignature"); - def("TSAsExpression").bases("Expression"); + def("TSAsExpression") + .build("expression") + .field("expression", def("Node")) + .bases("Expression"); def("TSNamespaceExportDeclaration") .bases("Declaration") diff --git a/tests/typescript_comments/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_comments/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..128bce0f8 --- /dev/null +++ b/tests/typescript_comments/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`types.ts 1`] = ` +(() => { + // swallow error and fallback to using directory as path +}) as string[]; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +(() => { + // swallow error and fallback to using directory as path +}) as string[]; + +`; diff --git a/tests/typescript_comments/jsfmt.spec.js b/tests/typescript_comments/jsfmt.spec.js new file mode 100644 index 000000000..bc085c48c --- /dev/null +++ b/tests/typescript_comments/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "typescript" }); diff --git a/tests/typescript_comments/types.ts b/tests/typescript_comments/types.ts new file mode 100644 index 000000000..8e277783b --- /dev/null +++ b/tests/typescript_comments/types.ts @@ -0,0 +1,3 @@ +(() => { + // swallow error and fallback to using directory as path +}) as string[];