-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
Button component as={Link}
triggers typecheck error
#1002
Comments
https://codesandbox.io/p/sandbox/dropdownas-f992mv?file=%2Fpages%2Findex.tsx%3A6%2C29
cc: @nigellima @rluders |
This impacts #1001 |
This is not working for me and also as={Link} not working |
I've avoided this in my codebase by creating a custom component that passes props to the button component:
I can use the |
any updates on this? |
`as` prop was throwing TS errors when using Next Link component. Now this correctly infers the type from any component passed to the `as` prop fix themesberg#1002 fix themesberg#1107
…tton `as` prop (#1244) * fix(button): correctly infer type from `as` prop `as` prop was throwing TS errors when using Next Link component. Now this correctly infers the type from any component passed to the `as` prop fix #1002 fix #1107 * fix(dropdown-item): applied the generic types to DropdownItem and also wraps it with a forwardRef * docs(button): removed now-unnecessary @ts-expect-error comments * fix(button): replaced use of old genericForwardRef
…tton `as` prop (themesberg#1244) * fix(button): correctly infer type from `as` prop `as` prop was throwing TS errors when using Next Link component. Now this correctly infers the type from any component passed to the `as` prop fix themesberg#1002 fix themesberg#1107 * fix(dropdown-item): applied the generic types to DropdownItem and also wraps it with a forwardRef * docs(button): removed now-unnecessary @ts-expect-error comments * fix(button): replaced use of old genericForwardRef
…tton `as` prop (themesberg#1244) * fix(button): correctly infer type from `as` prop `as` prop was throwing TS errors when using Next Link component. Now this correctly infers the type from any component passed to the `as` prop fix themesberg#1002 fix themesberg#1107 * fix(dropdown-item): applied the generic types to DropdownItem and also wraps it with a forwardRef * docs(button): removed now-unnecessary @ts-expect-error comments * fix(button): replaced use of old genericForwardRef
Steps to reproduce
dev
(which doesyarn dev
)Current behavior
The second button (
<Button as={Link} href="www.example.com">Toggle 2</Button>
) triggers a typechecker error:Expected behavior
No typechecker error.
Context
#885 made a series of Button and ButtonProps types / interfaces generic, attempting to allow
as={...}
. For some reason, this is not working foras={Link}
.The text was updated successfully, but these errors were encountered: