Kanstantsin Lazouski
Kanstantsin Lazouski
Hey, could somebody explain why does changing this: `T extends readonly any[]` into this: `T extends ReadonlyArray` fixes `@ts-expect-error` warning? Thanks
> It means to limit tuple types it will happen if without T extends ReadonlyArray So, in this case, it's kinda protecting the type from passing the second argument?
I guess, this one is more comprehensible: ``` type StringToTuple = S extends '' ? [] : S extends `${infer First}${infer Rest}` ? [First, ...StringToTuple] : never; type LengthOfString =...
A more universal solution that makes a lookup not only within the 'type' property: ``` type LookUp = U extends infer K ? T extends K[keyof K] ? K :...