Generated path type sometimes contains unnecessary paths
Papooch opened this issue · 0 comments
Papooch commented
Currently, if the ClsStore
interface contains a complex object, all possible nested paths are generated.
- It generates unnecessary paths for methods of arrays (
push
,fill
,concat
) - It generates unnecessary paths for some complex user-defined types
- It completely breaks if the type recursively references itself
Issue 1 could be easily solved by adding any[]
to the list of terminal types so array methods are not expanded.
Issue 2 is tricky, but could be probably solved by introducing a terminal "branded type" that would stop generating the paths beyond a certain point,
Example:
interface IRequestContext extends ClsStore {
really: {
complex: Terminal<{
nested: {
type: string
}
}>
}
}
Issue 3 most likely cannot be automatically detected and can only be addressed by the solution from issue 2.
This should only generate the following type union: really | really.complex
, ignoring whatever is inside the Terminal
type.
Todo: