diff --git a/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap index 9f673f0da2f3..fe39e136e522 100644 --- a/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap @@ -110,11 +110,23 @@ declare interface Dictionary { [index: string]: T } +declare interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + =====================================output===================================== declare interface Dictionary { [index: string]: T; } +declare interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + ================================================================================ `; diff --git a/tests/typescript/declare/declare_interface.ts b/tests/typescript/declare/declare_interface.ts index 77a9962cd03a..14e4bfe6177d 100644 --- a/tests/typescript/declare/declare_interface.ts +++ b/tests/typescript/declare/declare_interface.ts @@ -1,3 +1,9 @@ declare interface Dictionary { [index: string]: T } + +declare interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} diff --git a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap index 393512f5267e..6c3b914cd00c 100644 --- a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap @@ -844,6 +844,51 @@ export interface ThirdVeryLongAndBoringInterfaceName ================================================================================ `; +exports[`pattern-parameters.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + +=====================================output===================================== +interface B { + foo([]?): void + bar({}, []?): any + baz(a: string, b: number, []?): void +} + +================================================================================ +`; + +exports[`pattern-parameters.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + +=====================================output===================================== +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + +================================================================================ +`; + exports[`separator.ts - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/interface/pattern-parameters.ts b/tests/typescript/interface/pattern-parameters.ts new file mode 100644 index 000000000000..f1cf8d0d3d73 --- /dev/null +++ b/tests/typescript/interface/pattern-parameters.ts @@ -0,0 +1,5 @@ +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} diff --git a/tests/typescript/type-alias/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/type-alias/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..7f2c78b4eb82 --- /dev/null +++ b/tests/typescript/type-alias/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`pattern-parameter.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +type C = { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +}; + +=====================================output===================================== +type C = { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +}; + +================================================================================ +`; diff --git a/tests/typescript/type-alias/jsfmt.spec.js b/tests/typescript/type-alias/jsfmt.spec.js new file mode 100644 index 000000000000..2ea3bb6eb2e4 --- /dev/null +++ b/tests/typescript/type-alias/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["typescript"]); diff --git a/tests/typescript/type-alias/pattern-parameter.ts b/tests/typescript/type-alias/pattern-parameter.ts new file mode 100644 index 000000000000..6880a5bff23a --- /dev/null +++ b/tests/typescript/type-alias/pattern-parameter.ts @@ -0,0 +1,5 @@ +type C = { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +};