|
1 |
| -tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts(123,5): error TS2322: Type '(inputs: Unwrap<{ num: Wrapper<number>; str: Wrapper<string>; }>) => { bool: any; str: number; }' is not assignable to type '(inputs: Unwrap<{ num: Wrapper<number>; str: Wrapper<string>; }>) => Unwrap<{ bool: Wrapper<boolean>; str: Wrapper<string>; }>'. |
| 1 | +tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts(131,5): error TS2322: Type '(inputs: Unwrap<{ num: Wrapper<number>; str: Wrapper<string>; }>) => { bool: any; str: number; }' is not assignable to type '(inputs: Unwrap<{ num: Wrapper<number>; str: Wrapper<string>; }>) => Unwrap<{ bool: Wrapper<boolean>; str: Wrapper<string>; }>'. |
2 | 2 | Call signature return types '{ bool: any; str: number; }' and 'Unwrap<{ bool: Wrapper<boolean>; str: Wrapper<string>; }>' are incompatible.
|
3 | 3 | The types of 'str' are incompatible between these types.
|
4 | 4 | Type 'number' is not assignable to type 'string'.
|
5 |
| -tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts(125,26): error TS2339: Property 'nonexistent' does not exist on type 'Unwrap<{ num: Wrapper<number>; str: Wrapper<string>; }>'. |
| 5 | +tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts(133,26): error TS2339: Property 'nonexistent' does not exist on type 'Unwrap<{ num: Wrapper<number>; str: Wrapper<string>; }>'. |
6 | 6 |
|
7 | 7 |
|
8 | 8 | ==== tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts (2 errors) ====
|
@@ -97,6 +97,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInf
|
97 | 97 | }
|
98 | 98 | });
|
99 | 99 |
|
| 100 | + test({ |
| 101 | + a: () => 0, |
| 102 | + b: (a) => a, |
| 103 | + c: (b) => { |
| 104 | + const x: number = b; |
| 105 | + } |
| 106 | + }); |
| 107 | + |
100 | 108 | // Repro from #41712
|
101 | 109 |
|
102 | 110 | class Wrapper<T = any> {
|
@@ -134,7 +142,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInf
|
134 | 142 | !!! error TS2322: Call signature return types '{ bool: any; str: number; }' and 'Unwrap<{ bool: Wrapper<boolean>; str: Wrapper<string>; }>' are incompatible.
|
135 | 143 | !!! error TS2322: The types of 'str' are incompatible between these types.
|
136 | 144 | !!! error TS2322: Type 'number' is not assignable to type 'string'.
|
137 |
| -!!! related TS6500 tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts:105:5: The expected type comes from property 'map' which is declared here on type 'MappingComponent<{ num: Wrapper<number>; str: Wrapper<string>; }, { bool: Wrapper<boolean>; str: Wrapper<string>; }>' |
| 145 | +!!! related TS6500 tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts:113:5: The expected type comes from property 'map' which is declared here on type 'MappingComponent<{ num: Wrapper<number>; str: Wrapper<string>; }, { bool: Wrapper<boolean>; str: Wrapper<string>; }>' |
138 | 146 | return {
|
139 | 147 | bool: inputs.nonexistent,
|
140 | 148 | ~~~~~~~~~~~
|
@@ -189,4 +197,19 @@ tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInf
|
189 | 197 | fetch: (params: Params, foo) => 123,
|
190 | 198 | map: (number) => String(number)
|
191 | 199 | });
|
| 200 | + |
| 201 | + // Repro from #45255 |
| 202 | + |
| 203 | + declare const branch: |
| 204 | + <T, U extends T>(_: { test: T, if: (t: T) => t is U, then: (u: U) => void }) => void |
| 205 | + |
| 206 | + declare const x: "a" | "b" |
| 207 | + |
| 208 | + branch({ |
| 209 | + test: x, |
| 210 | + if: (t): t is "a" => t === "a", |
| 211 | + then: u => { |
| 212 | + let test1: "a" = u |
| 213 | + } |
| 214 | + }) |
192 | 215 |
|
0 commit comments