/
unresolvableSelfReferencingAwaitedUnion.errors.txt
47 lines (34 loc) · 2.11 KB
/
unresolvableSelfReferencingAwaitedUnion.errors.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
tests/cases/compiler/unresolvableSelfReferencingAwaitedUnion.ts(9,32): error TS2322: Type 'SimpleType' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'SimpleType'.
tests/cases/compiler/unresolvableSelfReferencingAwaitedUnion.ts(16,19): error TS1062: Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.
tests/cases/compiler/unresolvableSelfReferencingAwaitedUnion.ts(29,30): error TS1062: Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.
==== tests/cases/compiler/unresolvableSelfReferencingAwaitedUnion.ts (3 errors) ====
// repro #49646
type EnvFunction = <T>() => T;
type SimpleType = string | Promise<SimpleType>;
declare const simple: SimpleType;
const env: EnvFunction = () => simple;
~~~~~~
!!! error TS2322: Type 'SimpleType' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'SimpleType'.
!!! related TS6502 tests/cases/compiler/unresolvableSelfReferencingAwaitedUnion.ts:3:20: The expected type comes from the return type of this signature.
// repro #49723
type T1 = 1 | Promise<T1> | T1[];
export async function myFunction(param: T1) {
const awaited = await param
~~~~~~~~~~~
!!! error TS1062: Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.
}
// repro #42948
type EffectResult =
| (() => EffectResult)
| Promise<EffectResult>;
export async function handleEffectResult(result: EffectResult) {
if (result instanceof Function) {
await handleEffectResult(result());
} else if (result instanceof Promise) {
await handleEffectResult(await result);
~~~~~~~~~~~~
!!! error TS1062: Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method.
}
}