Closed
Description
Bug Report
DeepNamePath<T>
result is equal to ['a'] | ['b']
, but result different
🔎 Search Terms
🕗 Version & Regression Information
- This is a crash
- This changed between versions ______ and _______
- 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 DeepNamePath<T = any> = T extends Record<string, any>
? {
[P in keyof T]: [P] | DeepNamePath<T[P]>;
}[keyof T]
: never;
type ddd<T = any> = ['a'] | ['b'] // result is ['a']
// type ddd<T = any> = DeepNamePath<T>; // result is ['a'] | ['b']
function func<T = any, T1 extends ddd<T> = ddd<T>>(data: T, params: T1) {
console.log('data', data);
return params;
}
export const d = func({ a: '', b: '' }, ['a']);
type result = typeof d
// ^?
🙁 Actual behavior
['a']
🙂 Expected behavior
['a' , 'b']
Metadata
Metadata
Assignees
Labels
No labels