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 with Router children #15

Open
rschristian opened this issue Apr 6, 2024 · 0 comments
Open

Type issue with Router children #15

rschristian opened this issue Apr 6, 2024 · 0 comments

Comments

@rschristian
Copy link
Member

<Router>
    {['/', '/foo'].map((r) => (
        <Route path={r} component={Example} />
    ))}
    <Route path="/bar" component={Example} />
</Router>

This should be valid but the expression returns the following error:

Type 'Element[]' is missing the following properties from type 'VNode<{}>': type, props, key(2739)

(Weirdly enough, without the additional <Route>, no error is returned at all)

Route returns a VNode, not quite sure how in the world that becomes an Element[]. Expanding the children type to be a union of VNode[] | JSXInternal.Element[] allows for some invalid children that will break routing, so that's seemingly a no-go.

Not quite sure what the correct type is meant to be here.

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