From 641e54173836b4248dd329e640158118dc537b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 22 May 2020 12:56:43 +0200 Subject: [PATCH] add test case --- cli/tests/integration_tests.rs | 7 +++++++ cli/tests/ts_type_imports.ts | 3 +++ cli/tests/ts_type_imports.ts.out | 6 ++++++ cli/tests/ts_type_imports_foo.ts | 1 + 4 files changed, 17 insertions(+) create mode 100644 cli/tests/ts_type_imports.ts create mode 100644 cli/tests/ts_type_imports.ts.out create mode 100644 cli/tests/ts_type_imports_foo.ts diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 9948567da2e4fa..b6781a4909be84 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1571,6 +1571,13 @@ itest!(type_directives_redirect { http_server: true, }); +itest!(ts_type_imports { + args: "run --reload ts_type_imports.ts", + output: "ts_type_imports.ts.out", + exit_code: 1, + http_server: true, +}); + itest!(types { args: "types", output: "types.out", diff --git a/cli/tests/ts_type_imports.ts b/cli/tests/ts_type_imports.ts new file mode 100644 index 00000000000000..03a9bb94ec6f69 --- /dev/null +++ b/cli/tests/ts_type_imports.ts @@ -0,0 +1,3 @@ +type Foo = import("./ts_type_imports_foo.ts").Foo; + +const foo: Foo = new Map(); diff --git a/cli/tests/ts_type_imports.ts.out b/cli/tests/ts_type_imports.ts.out new file mode 100644 index 00000000000000..2083a88d3b04a8 --- /dev/null +++ b/cli/tests/ts_type_imports.ts.out @@ -0,0 +1,6 @@ +Compile [WILDCARD]ts_type_imports.ts +error: TS2322 [ERROR]: Type 'Map' is not assignable to type 'Foo'. + Type 'string' is not assignable to type 'number'. +const foo: Foo = new Map(); + ~~~ + at [WILDCARD]ts_type_imports.ts:3:7 diff --git a/cli/tests/ts_type_imports_foo.ts b/cli/tests/ts_type_imports_foo.ts new file mode 100644 index 00000000000000..db20773f63f00e --- /dev/null +++ b/cli/tests/ts_type_imports_foo.ts @@ -0,0 +1 @@ +export type Foo = Map;