Skip to content

Commit 97c164d

Browse files
committed
add extra test case
1 parent b0563e8 commit 97c164d

3 files changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//// [tests/cases/compiler/inferenceContextualReturnTypeUnion4.ts] ////
2+
3+
=== inferenceContextualReturnTypeUnion4.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/57905
5+
6+
export abstract class Storage {
7+
>Storage : Symbol(Storage, Decl(inferenceContextualReturnTypeUnion4.ts, 0, 0))
8+
9+
abstract get<T extends string>(): T | Promise<T>;
10+
>get : Symbol(Storage.get, Decl(inferenceContextualReturnTypeUnion4.ts, 2, 31))
11+
>T : Symbol(T, Decl(inferenceContextualReturnTypeUnion4.ts, 3, 17))
12+
>T : Symbol(T, Decl(inferenceContextualReturnTypeUnion4.ts, 3, 17))
13+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
14+
>T : Symbol(T, Decl(inferenceContextualReturnTypeUnion4.ts, 3, 17))
15+
}
16+
17+
export abstract class SyncStorage extends Storage {
18+
>SyncStorage : Symbol(SyncStorage, Decl(inferenceContextualReturnTypeUnion4.ts, 4, 1))
19+
>Storage : Symbol(Storage, Decl(inferenceContextualReturnTypeUnion4.ts, 0, 0))
20+
21+
abstract override get<T extends string>(): T;
22+
>get : Symbol(SyncStorage.get, Decl(inferenceContextualReturnTypeUnion4.ts, 6, 51))
23+
>T : Symbol(T, Decl(inferenceContextualReturnTypeUnion4.ts, 7, 26))
24+
>T : Symbol(T, Decl(inferenceContextualReturnTypeUnion4.ts, 7, 26))
25+
}
26+
27+
export abstract class ASyncStorage extends Storage {
28+
>ASyncStorage : Symbol(ASyncStorage, Decl(inferenceContextualReturnTypeUnion4.ts, 8, 1))
29+
>Storage : Symbol(Storage, Decl(inferenceContextualReturnTypeUnion4.ts, 0, 0))
30+
31+
abstract override get<T extends string>(): Promise<T>;
32+
>get : Symbol(ASyncStorage.get, Decl(inferenceContextualReturnTypeUnion4.ts, 10, 52))
33+
>T : Symbol(T, Decl(inferenceContextualReturnTypeUnion4.ts, 11, 26))
34+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
35+
>T : Symbol(T, Decl(inferenceContextualReturnTypeUnion4.ts, 11, 26))
36+
}
37+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//// [tests/cases/compiler/inferenceContextualReturnTypeUnion4.ts] ////
2+
3+
=== inferenceContextualReturnTypeUnion4.ts ===
4+
// https://github.com/microsoft/TypeScript/issues/57905
5+
6+
export abstract class Storage {
7+
>Storage : Storage
8+
> : ^^^^^^^
9+
10+
abstract get<T extends string>(): T | Promise<T>;
11+
>get : <T extends string>() => T | Promise<T>
12+
> : ^ ^^^^^^^^^ ^^^^^^^
13+
}
14+
15+
export abstract class SyncStorage extends Storage {
16+
>SyncStorage : SyncStorage
17+
> : ^^^^^^^^^^^
18+
>Storage : Storage
19+
> : ^^^^^^^
20+
21+
abstract override get<T extends string>(): T;
22+
>get : <T extends string>() => T
23+
> : ^ ^^^^^^^^^ ^^^^^^^
24+
}
25+
26+
export abstract class ASyncStorage extends Storage {
27+
>ASyncStorage : ASyncStorage
28+
> : ^^^^^^^^^^^^
29+
>Storage : Storage
30+
> : ^^^^^^^
31+
32+
abstract override get<T extends string>(): Promise<T>;
33+
>get : <T extends string>() => Promise<T>
34+
> : ^ ^^^^^^^^^ ^^^^^^^
35+
}
36+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @strict: true
2+
// @lib: esnext
3+
// @noEmit: true
4+
5+
// https://github.com/microsoft/TypeScript/issues/57905
6+
7+
export abstract class Storage {
8+
abstract get<T extends string>(): T | Promise<T>;
9+
}
10+
11+
export abstract class SyncStorage extends Storage {
12+
abstract override get<T extends string>(): T;
13+
}
14+
15+
export abstract class ASyncStorage extends Storage {
16+
abstract override get<T extends string>(): Promise<T>;
17+
}

0 commit comments

Comments
 (0)