Skip to content

Fix: Infer useRouteData return type for nested routeData#1002

Merged
ryansolid merged 1 commit intosolidjs:mainfrom
emdede:emdede-patch-1-1
Aug 16, 2023
Merged

Fix: Infer useRouteData return type for nested routeData#1002
ryansolid merged 1 commit intosolidjs:mainfrom
emdede:emdede-patch-1-1

Conversation

@emdede
Copy link
Copy Markdown
Contributor

@emdede emdede commented Aug 15, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

See #982 the 2nd issue.

What is the new behavior?

I made adjustments to the useRouteData overload in line with the RouteDataFunc return type inference first added by otonashi here

This restores the ability to correctly infer nested routeData type. However, this seems only to work when using the type RouteDataFuncArgs instead of RouteDataArgs. I am not sure if there are breaking side-effects, it only fixes this specific issue. I have added an example to the stackblitz mentioned in the issue.

This might not be the desired solution but I consider it a first step.

@ryansolid ryansolid merged commit b2a09b3 into solidjs:main Aug 16, 2023
rempartIrien added a commit to rempartIrien/easy-gundam that referenced this pull request Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants