Steps to reproduce
declare function flat<T>(args: T[] | T[][]): void;
type Value = 1 | 2
declare const n: Value[] | Value[][]
flat(n)
Behavior with typescript@5.8
Type checks, T is inferred as Value
Behavior with tsgo
We get an error in flat(n):
error TS2345: Argument of type 'Value[][] | Value[]' is not assignable to parameter of type 'Value[][][] | Value[][]'.
Type 'Value[]' is not assignable to type 'Value[][][] | Value[][]'.
Type 'Value[]' is not assignable to type 'Value[][][]'.
Type 'number' is not assignable to type 'Value[][]'.
Type 'number' is not assignable to type 'Value[][]'.
Steps to reproduce
Behavior with
typescript@5.8Type checks,
Tis inferred asValueBehavior with
tsgoWe get an error in
flat(n):error TS2345: Argument of type 'Value[][] | Value[]' is not assignable to parameter of type 'Value[][][] | Value[][]'. Type 'Value[]' is not assignable to type 'Value[][][] | Value[][]'. Type 'Value[]' is not assignable to type 'Value[][][]'. Type 'number' is not assignable to type 'Value[][]'. Type 'number' is not assignable to type 'Value[][]'.