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

<Link> uses widened from type for relative to, unlike linkOptions #3031

Closed
nstepien opened this issue Dec 17, 2024 · 0 comments
Closed

<Link> uses widened from type for relative to, unlike linkOptions #3031

nstepien opened this issue Dec 17, 2024 · 0 comments
Labels
types Changes to the typescript types

Comments

@nstepien
Copy link
Contributor

Which project does this relate to?

Router

Describe the bug

The behavior of <Link> types differ from linkOptions when a string union type is used in from.

Your Example Website or App

https://stackblitz.com/edit/github-txkpx7fm?file=src%2Froutes%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Open example
  2. Notice how linkOptions() catches issues without requiring as const 👍
  3. Notice how <Link> incorrectly flags a valid path as invalid when as const is not used 👎
  4. Notice how <Link> needs as const to have types behave correctly 👎

Expected behavior

Type safety parity between linkOptions and <Link>.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Chrome
  • Version: 131.0.6778.140

Additional context

Possibly related to #2623 and #3029

@SeanCassiere SeanCassiere added the types Changes to the typescript types label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types Changes to the typescript types
Projects
None yet
Development

No branches or pull requests

3 participants