You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeImmutableTuple2={readonly[0]: numberreadonly[1]: string}&Iterable<number|string>constf=<T>(_v: T,_c: (v: T)=>void)=>{}constv: ImmutableTuple2=[4,"hello"]f(v,([a,b])=>{const_a: number=a// a should be a `number` but it's `number`|`string` in TS 3.3const_b: string=b// b should be a `string` but it's `number`|`string` in TS 3.3})
Expected behavior:
No compilation errors. (TypeScript 3.2)
Actual behavior:
TypeScript 3.3.1 and up
src/test.ts:11:11 - error TS2322: Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
11 const _a: number = a
~~
src/test.ts:12:11 - error TS2322: Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
12 const _b: string = b
~~
Found 2 errors
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered:
typeImmutableTuple2={readonly[0]: numberreadonly[1]: string}&Iterable<number|string>constf=([a,b]: ImmutableTuple2)=>{const_a: number=a// a should be a `number` but it's `number`|`string` in TS 3.3const_b: string=b// b should be a `string` but it's `number`|`string` in TS 3.3}
We no longer recognize "pseudo-tuples" like ImmutableTuple2 and given the intrinsic support I don't think adding more complexity in this area is worth it. So, I'm closing this issue.
TypeScript Version: 3.3.1 and 3.4.1
Search Terms:
Code
Expected behavior:
No compilation errors. (TypeScript 3.2)
Actual behavior:
TypeScript 3.3.1 and up
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: