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

Type issue: RouteLoadFunc generic cannot be inferred correctly #454

Open
atk opened this issue Jun 20, 2024 · 0 comments
Open

Type issue: RouteLoadFunc generic cannot be inferred correctly #454

atk opened this issue Jun 20, 2024 · 0 comments

Comments

@atk
Copy link

atk commented Jun 20, 2024

Describe the bug

Using a RouteLoadFunc, the component is always expected to be a Component<RouterSectionProps<unknown>>; the inferral of the RouterSectionProps generic T seems to fail.

Your Example Website or App

https://playground.solidjs.com/anonymous/9cbd974a-0126-4c72-9019-f87ac703f263

Steps to Reproduce the Bug or Issue

Create a route:

{
  path: "/",
  component: lazy(import("./ComponentUsingLoadFunc")), // typed as Component<RouterSectionProps<{ x: string, y: string }>>, expected: Component<RouterSectionProps<unknown>>
  load: loadFunc // () => { x: string, y: string }
}

Or copy the playground into your editor and install the actual dependencies so that TS works.

Expected behavior

I expect the type of a load function to be inferred correctly.

Screenshots or Videos

No response

Platform

  • OS: macOS, Windows, Linux
  • Browser: ./. - tsserver
  • Version: 0.13.5

Additional context

No response

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

No branches or pull requests

1 participant