Skip to content

Commit

Permalink
Test generics in object methods in TS
Browse files Browse the repository at this point in the history
as proposed in the following PR: prettier#5824

Note that this test is not expected to succeed without code changes
when using an outdated version of the following dependency:
@typescript-eslint/typescript-estree

Co-authored-by: Jed Fox <git@twopointzero.us>
Co-authored-by: Christopher J. Brody <chris@brody.consulting>
  • Loading branch information
Christopher J. Brody and j-f1 committed Apr 4, 2019
1 parent dcaed91 commit a67c315
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
23 changes: 23 additions & 0 deletions 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, T>(k: K, t: T) {
return {k, t};
}
}
=====================================output=====================================
export default {
load<K, T>(k: K, t: T) {
return { k, t };
}
};
================================================================================
`;
1 change: 1 addition & 0 deletions tests/typescript_generic/jsfmt.spec.js
@@ -0,0 +1 @@
run_spec(__dirname, ["typescript"]);
5 changes: 5 additions & 0 deletions tests/typescript_generic/object-method.ts
@@ -0,0 +1,5 @@
export default {
load<K, T>(k: K, t: T) {
return {k, t};
}
}

0 comments on commit a67c315

Please sign in to comment.