diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/013_dynamic_import.ts | 8 | ||||
-rw-r--r-- | tests/error_003_typescript.test | 1 | ||||
-rw-r--r-- | tests/error_003_typescript.ts | 28 | ||||
-rw-r--r-- | tests/error_003_typescript.ts.out | 26 | ||||
-rw-r--r-- | tests/error_003_typescript2.test | 1 |
5 files changed, 50 insertions, 14 deletions
diff --git a/tests/013_dynamic_import.ts b/tests/013_dynamic_import.ts index 20dc508db..6bbce3132 100644 --- a/tests/013_dynamic_import.ts +++ b/tests/013_dynamic_import.ts @@ -1,9 +1,7 @@ (async (): Promise<void> => { - const { - returnsHi, - returnsFoo2, - printHello3 - } = await import("./subdir/mod1.ts"); + const { returnsHi, returnsFoo2, printHello3 } = await import( + "./subdir/mod1.ts" + ); printHello3(); diff --git a/tests/error_003_typescript.test b/tests/error_003_typescript.test index f721829a2..a7a68627a 100644 --- a/tests/error_003_typescript.test +++ b/tests/error_003_typescript.test @@ -1,3 +1,4 @@ args: run --reload tests/error_003_typescript.ts +check_stderr: true exit_code: 1 output: tests/error_003_typescript.ts.out diff --git a/tests/error_003_typescript.ts b/tests/error_003_typescript.ts index ebd9fcbe6..6fb077ea0 100644 --- a/tests/error_003_typescript.ts +++ b/tests/error_003_typescript.ts @@ -1,2 +1,26 @@ -// console.log intentionally misspelled to trigger TypeScript error -consol.log("hello world!"); +/* eslint-disable */ +interface Value<T> { + f?: (r: T) => any; + v?: string; +} + +interface C<T> { + values?: (r: T) => Array<Value<T>>; +} + +class A<T> { + constructor(private e?: T, public s?: C<T>) {} +} + +class B { + t = "foo"; +} + +var a = new A(new B(), { + values: o => [ + { + v: o.t, + f: x => "bar" + } + ] +}); diff --git a/tests/error_003_typescript.ts.out b/tests/error_003_typescript.ts.out index 65bc33591..e2efd5639 100644 --- a/tests/error_003_typescript.ts.out +++ b/tests/error_003_typescript.ts.out @@ -1,10 +1,22 @@ -[WILDCARD]tests/error_003_typescript.ts[WILDCARD] - error TS2552: Cannot find name 'consol'. Did you mean 'console'? +[WILDCARD]/tests/error_003_typescript.ts:20:3 - error TS2322: Type '(o: T) => { v: any; f: (x: B) => string; }[]' is not assignable to type '(r: B) => Value<B>[]'. + Types of parameters 'o' and 'r' are incompatible. + Type 'B' is not assignable to type 'T'. + 'B' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'. -[WILDCARD] consol.log("hello world!"); -[WILDCARD]~~~~~~ +20 values: o => [ + ~~~~~~ - $asset$/lib.deno_runtime.d.ts[WILDCARD] -[WILDCARD]declare const console: consoleTypes.Console; -[WILDCARD]~~~~~~~ -[WILDCARD]'console' is declared here. + [WILDCARD]/tests/error_003_typescript.ts:8:3 + + 8 values?: (r: T) => Array<Value<T>>; + ~~~~~~ + The expected type comes from property 'values' which is declared here on type 'C<B>' + +[WILDCARD]/tests/error_003_typescript.ts:22:12 - error TS2339: Property 't' does not exist on type 'T'. + +22 v: o.t, + ^ + + +Found 2 errors. diff --git a/tests/error_003_typescript2.test b/tests/error_003_typescript2.test index 62e66d7e7..c4c724259 100644 --- a/tests/error_003_typescript2.test +++ b/tests/error_003_typescript2.test @@ -3,5 +3,6 @@ # should result in the same output. # https://github.com/denoland/deno/issues/2436 args: run tests/error_003_typescript.ts +check_stderr: true exit_code: 1 output: tests/error_003_typescript.ts.out |