From 6ae41067cf287fd3c8ee6dec1da0bfe49d9edeeb Mon Sep 17 00:00:00 2001 From: Chris Brody Date: Mon, 8 Apr 2019 15:56:39 -0400 Subject: [PATCH] Test generics in object methods in TypeScript (#5989) --- .../__snapshots__/jsfmt.spec.js.snap | 23 +++++++++++++++++++ tests/typescript_generic/jsfmt.spec.js | 1 + tests/typescript_generic/object-method.ts | 5 ++++ 3 files changed, 29 insertions(+) create mode 100644 tests/typescript_generic/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/typescript_generic/jsfmt.spec.js create mode 100644 tests/typescript_generic/object-method.ts diff --git a/tests/typescript_generic/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_generic/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..3009a3eb7 --- /dev/null +++ b/tests/typescript_generic/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`object-method.ts 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +export default { + load(k: K, t: T) { + return {k, t}; + } +} + +=====================================output===================================== +export default { + load(k: K, t: T) { + return { k, t }; + } +}; + +================================================================================ +`; diff --git a/tests/typescript_generic/jsfmt.spec.js b/tests/typescript_generic/jsfmt.spec.js new file mode 100644 index 000000000..2ea3bb6eb --- /dev/null +++ b/tests/typescript_generic/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["typescript"]); diff --git a/tests/typescript_generic/object-method.ts b/tests/typescript_generic/object-method.ts new file mode 100644 index 000000000..9d104237b --- /dev/null +++ b/tests/typescript_generic/object-method.ts @@ -0,0 +1,5 @@ +export default { + load(k: K, t: T) { + return {k, t}; + } +}