|
| 1 | +=== tests/cases/compiler/conditionalTypeBasedContextualTypeReturnTypeWidening.ts === |
| 2 | +declare function useState1<S>(initialState: (S extends (() => any) ? never : S) | (() => S)): S; // No args |
| 3 | +>useState1 : Symbol(useState1, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 0)) |
| 4 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 27)) |
| 5 | +>initialState : Symbol(initialState, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 30)) |
| 6 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 27)) |
| 7 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 27)) |
| 8 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 27)) |
| 9 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 27)) |
| 10 | + |
| 11 | +declare function useState2<S>(initialState: (S extends ((...args: any[]) => any) ? never : S) | (() => S)): S; // Any args |
| 12 | +>useState2 : Symbol(useState2, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 96)) |
| 13 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 1, 27)) |
| 14 | +>initialState : Symbol(initialState, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 1, 30)) |
| 15 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 1, 27)) |
| 16 | +>args : Symbol(args, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 1, 57)) |
| 17 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 1, 27)) |
| 18 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 1, 27)) |
| 19 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 1, 27)) |
| 20 | + |
| 21 | +const func1 = useState1(() => () => 0); |
| 22 | +>func1 : Symbol(func1, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 3, 5)) |
| 23 | +>useState1 : Symbol(useState1, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 0)) |
| 24 | + |
| 25 | +const func2 = useState2(() => () => 0); |
| 26 | +>func2 : Symbol(func2, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 4, 5)) |
| 27 | +>useState2 : Symbol(useState2, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 96)) |
| 28 | + |
| 29 | +declare function useState3<S, T extends S>(initialState: (T extends (() => any) ? never : T) | (() => S)): S; // No args |
| 30 | +>useState3 : Symbol(useState3, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 4, 39)) |
| 31 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 27)) |
| 32 | +>T : Symbol(T, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 29)) |
| 33 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 27)) |
| 34 | +>initialState : Symbol(initialState, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 43)) |
| 35 | +>T : Symbol(T, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 29)) |
| 36 | +>T : Symbol(T, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 29)) |
| 37 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 27)) |
| 38 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 27)) |
| 39 | + |
| 40 | +declare function useState4<S, T extends S>(initialState: (T extends ((...args: any[]) => any) ? never : T) | (() => S)): S; // Any args |
| 41 | +>useState4 : Symbol(useState4, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 6, 109)) |
| 42 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 27)) |
| 43 | +>T : Symbol(T, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 29)) |
| 44 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 27)) |
| 45 | +>initialState : Symbol(initialState, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 43)) |
| 46 | +>T : Symbol(T, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 29)) |
| 47 | +>args : Symbol(args, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 70)) |
| 48 | +>T : Symbol(T, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 29)) |
| 49 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 27)) |
| 50 | +>S : Symbol(S, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 7, 27)) |
| 51 | + |
| 52 | +const func3 = useState1(() => () => 0); |
| 53 | +>func3 : Symbol(func3, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 9, 5)) |
| 54 | +>useState1 : Symbol(useState1, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 0)) |
| 55 | + |
| 56 | +const func4 = useState2(() => () => 0); |
| 57 | +>func4 : Symbol(func4, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 10, 5)) |
| 58 | +>useState2 : Symbol(useState2, Decl(conditionalTypeBasedContextualTypeReturnTypeWidening.ts, 0, 96)) |
| 59 | + |
0 commit comments