diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-08-23 02:05:01 +1000 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-22 12:05:01 -0400 |
commit | 6c7d337960b3745a7b614a18150862279ef1c942 (patch) | |
tree | ab2d432d80c1bb2bfdc9d77de1644d3b1e4fa4b7 /tests | |
parent | bdc97b3976786bb744a27e59b0f4f28554a682df (diff) |
Support .d.ts files (#2746)
Fixes #1432
Diffstat (limited to 'tests')
-rw-r--r-- | tests/error_type_definitions.test | 4 | ||||
-rw-r--r-- | tests/error_type_definitions.ts | 5 | ||||
-rw-r--r-- | tests/error_type_definitions.ts.out | 4 | ||||
-rw-r--r-- | tests/type_definitions.test | 2 | ||||
-rw-r--r-- | tests/type_definitions.ts | 4 | ||||
-rw-r--r-- | tests/type_definitions.ts.out | 1 | ||||
-rw-r--r-- | tests/type_definitions/bar.d.ts | 7 | ||||
-rw-r--r-- | tests/type_definitions/foo.d.ts | 2 | ||||
-rw-r--r-- | tests/type_definitions/foo.js | 1 |
9 files changed, 30 insertions, 0 deletions
diff --git a/tests/error_type_definitions.test b/tests/error_type_definitions.test new file mode 100644 index 000000000..367edacc5 --- /dev/null +++ b/tests/error_type_definitions.test @@ -0,0 +1,4 @@ +args: run --reload tests/error_type_definitions.ts +check_stderr: true +exit_code: 1 +output: tests/error_type_definitions.ts.out diff --git a/tests/error_type_definitions.ts b/tests/error_type_definitions.ts new file mode 100644 index 000000000..ceb11787e --- /dev/null +++ b/tests/error_type_definitions.ts @@ -0,0 +1,5 @@ +// @deno-types="./type_definitions/bar.d.ts" +import { Bar } from "./type_definitions/bar.js"; + +const bar = new Bar(); +console.log(bar); diff --git a/tests/error_type_definitions.ts.out b/tests/error_type_definitions.ts.out new file mode 100644 index 000000000..4b29b5b83 --- /dev/null +++ b/tests/error_type_definitions.ts.out @@ -0,0 +1,4 @@ +[WILDCARD]error: Uncaught TypeError: Automatic type resolution not supported +[WILDCARD]js/compiler.ts:[WILDCARD] + at fileExists (js/compiler.ts:[WILDCARD]) +[WILDCARD]
\ No newline at end of file diff --git a/tests/type_definitions.test b/tests/type_definitions.test new file mode 100644 index 000000000..7ce8d896d --- /dev/null +++ b/tests/type_definitions.test @@ -0,0 +1,2 @@ +args: run --reload tests/type_definitions.ts +output: tests/type_definitions.ts.out diff --git a/tests/type_definitions.ts b/tests/type_definitions.ts new file mode 100644 index 000000000..372501166 --- /dev/null +++ b/tests/type_definitions.ts @@ -0,0 +1,4 @@ +// @deno-types="./type_definitions/foo.d.ts" +import { foo } from "./type_definitions/foo.js"; + +console.log(foo); diff --git a/tests/type_definitions.ts.out b/tests/type_definitions.ts.out new file mode 100644 index 000000000..291e85a7b --- /dev/null +++ b/tests/type_definitions.ts.out @@ -0,0 +1 @@ +[WILDCARD]foo diff --git a/tests/type_definitions/bar.d.ts b/tests/type_definitions/bar.d.ts new file mode 100644 index 000000000..d43335dbb --- /dev/null +++ b/tests/type_definitions/bar.d.ts @@ -0,0 +1,7 @@ +/// <reference types="baz" /> + +declare namespace bar { + export class Bar { + baz: string; + } +} diff --git a/tests/type_definitions/foo.d.ts b/tests/type_definitions/foo.d.ts new file mode 100644 index 000000000..ce39201e1 --- /dev/null +++ b/tests/type_definitions/foo.d.ts @@ -0,0 +1,2 @@ +/** An exported value. */ +export const foo: string; diff --git a/tests/type_definitions/foo.js b/tests/type_definitions/foo.js new file mode 100644 index 000000000..61d366eb2 --- /dev/null +++ b/tests/type_definitions/foo.js @@ -0,0 +1 @@ +export const foo = "foo"; |