Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #917
Introduce
PathsOptions
withmaxRecursionDepth
.Things up for debate
type-fest/test-d/paths.ts
Line 109 in 8a45ba0
worked fine with the old recursion limit of 15 but now throws an error "Type instantiation is excessively deep and possibly infinite". Setting the limit to 14 fixes it. Technically, this introduces a small breaking change.
In my experience, most paths that are more than 4 levels deep do not really add value most of the time. So I would suggest having a smaller default like 8 or 10. This would speed up type checking times for users and slightly reduce the bloated wall of intellisense suggestions. If users need more, they can set
maxRecursionDepth
manually.InternalPaths
is currently exported. Perhaps so that users have a way to get their hands on theDepth
parameter. If that is the only reason, we could consider not exporting it now thatPaths
supports it.