-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
The issue
Given the following code:
import { getByPath } from 'dot-path-value';
type Recursive = {
a: string;
r: Recursive;
};
function x(type: Recursive) {
getByPath(type, '');
~~~~~~~~~~~~
}
we get the following error:
Type of property 'r' circularly references itself in mapped type
'{ [K in //keyof Recursive]-?: PathConcat<K & string, Recursive[K]>; }'.(2615)
which makes sense why it would not print until infinity (or at the max TS iterations).
Suggestion
Don't try to infer the fields of the recursive type, or allow inference for only one level deep.
BTW, really cool library, thanks for sharing 🙂
bduyng, sterzhakov, lukasbash, cpannwitz and bekarys-alukasbash
Metadata
Metadata
Assignees
Labels
No labels