diff --git a/tests/format/misc/errors/typescript/mapped-type/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/typescript/mapped-type/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..61e26fd40 --- /dev/null +++ b/tests/format/misc/errors/typescript/mapped-type/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`mapped-type.ts [babel-ts] format 1`] = ` +"Unexpected token, expected "}" (3:3) + 1 | type Mapped = { + 2 | [key in keyof O]: number; +> 3 | extra_member: should_not_allowed + | ^ + 4 | }; + 5 |" +`; + +exports[`mapped-type.ts [typescript] format 1`] = ` +"A mapped type may not declare properties or methods. (3:3) + 1 | type Mapped = { + 2 | [key in keyof O]: number; +> 3 | extra_member: should_not_allowed + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 4 | }; + 5 |" +`; diff --git a/tests/format/misc/errors/typescript/mapped-type/jsfmt.spec.js b/tests/format/misc/errors/typescript/mapped-type/jsfmt.spec.js new file mode 100644 index 000000000..d6e90943d --- /dev/null +++ b/tests/format/misc/errors/typescript/mapped-type/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(import.meta, ["babel-ts", "typescript"]); diff --git a/tests/format/misc/errors/typescript/mapped-type/mapped-type.ts b/tests/format/misc/errors/typescript/mapped-type/mapped-type.ts new file mode 100644 index 000000000..6e560a0bc --- /dev/null +++ b/tests/format/misc/errors/typescript/mapped-type/mapped-type.ts @@ -0,0 +1,4 @@ +type Mapped = { + [key in keyof O]: number; + extra_member: should_not_allowed +};