-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed as not planned
Closed as not planned
Copy link
Labels
UnactionableThere isn't something we can do with this issueThere isn't something we can do with this issue
Description
Bug Report
🔎 Search Terms
error TS2589: Type instantiation is excessively deep and possibly infinite.
🕗 Version & Regression Information
- This is a crash
- This changed between versions 4.9 and 5.1.6
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
Playground link with relevant code
💻 Code
export type DefineObjPath<T, T1 extends any[] = unknown[]> = {
[P in keyof T]: Required<T>[P] extends object
? DefineObjPath<Required<T>[P], T1[number] extends string ? [...T1, P] : [P]>
: P | [...T1, P];
}[keyof T];
export interface TableProps<T = any> {
dataSource?: T[];
columns?: { dataIndex?: DefineObjPath<T> }[];
}
export function func<T = any>(props: TableProps<T>) {
return props;
}
export const demo = func({ dataSource: [{ a: { b: 'c' } }], columns: [{ dataIndex: ['a', 'b'] }] });
// check type
export type checkType = DefineObjPath<{ a: { b: string } }>;
🙁 Actual behavior
🙂 Expected behavior
MartinJohns and xiBreadcrazyair and jcalz
Metadata
Metadata
Assignees
Labels
UnactionableThere isn't something we can do with this issueThere isn't something we can do with this issue