Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to Paths #920

Merged

Conversation

fardolieri
Copy link
Contributor

@fardolieri fardolieri commented Jul 19, 2024

Fixes #917

Introduce PathsOptions with maxRecursionDepth.

Things up for debate

  • By introducing the new options parameter, which adds a bit more complexity, the previous test-case
    type MyEntityPaths = Paths<MyEntity>;

    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.
  • I'm not sure why InternalPaths is currently exported. Perhaps so that users have a way to get their hands on the Depth parameter. If that is the only reason, we could consider not exporting it now that Paths supports it.

@voxpelli
Copy link
Collaborator

Related: #919

@sindresorhus sindresorhus merged commit 052e887 into sindresorhus:main Jul 22, 2024
8 checks passed
@voxpelli
Copy link
Collaborator

Might have caused a regression: #922

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Max Recursion Depth of Paths
3 participants