mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
34 lines
1.8 KiB
Plaintext
34 lines
1.8 KiB
Plaintext
flatArrayNoExcessiveStackDepth.ts(20,5): error TS2322: Type 'FlatArray<Arr, any>' is not assignable to type 'FlatArray<Arr, D>'.
|
|
Type 'Arr' is not assignable to type 'FlatArray<Arr, D>'.
|
|
Type 'Arr' is not assignable to type 'Arr & (Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr)'.
|
|
Type 'Arr' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
|
|
|
|
|
==== flatArrayNoExcessiveStackDepth.ts (1 errors) ====
|
|
// Repro from #43493
|
|
|
|
declare const foo: unknown[];
|
|
const bar = foo.flatMap(bar => bar as Foo);
|
|
|
|
interface Foo extends Array<string> {}
|
|
|
|
// Repros from comments in #43249
|
|
|
|
const repro_43249 = (value: unknown) => {
|
|
if (typeof value !== "string") {
|
|
throw new Error("No");
|
|
}
|
|
const match = value.match(/anything/) || [];
|
|
const [, extracted] = match;
|
|
};
|
|
|
|
function f<Arr, D extends number>(x: FlatArray<Arr, any>, y: FlatArray<Arr, D>) {
|
|
x = y;
|
|
y = x; // Error
|
|
~
|
|
!!! error TS2322: Type 'FlatArray<Arr, any>' is not assignable to type 'FlatArray<Arr, D>'.
|
|
!!! error TS2322: Type 'Arr' is not assignable to type 'FlatArray<Arr, D>'.
|
|
!!! error TS2322: Type 'Arr' is not assignable to type 'Arr & (Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr)'.
|
|
!!! error TS2322: Type 'Arr' is not assignable to type 'Arr extends readonly (infer InnerArr)[] ? FlatArray<InnerArr, [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20][D]> : Arr'.
|
|
}
|
|
|