You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integrating with component libraries like React Aria Components this is confusing which use isDisabled instead of disabled
import{createLink}from"@tanstack/react-router";importtype{ReactNode,Ref}from"react";import{LinkasAriaLink,typeLinkPropsasAriaLinkProps,}from"react-aria-components";interfaceButtonLinkPropsextendsAriaLinkProps{ref?: Ref<HTMLAnchorElement>;children?: ReactNode;}constBaseButtonLink=(props: ButtonLinkProps): ReactNode=>{const{ children, ...propsToForward}=props;return<AriaLink{...propsToForward}>{children}</AriaLink>;};exportconstButtonLink=createLink(BaseButtonLink);// This line inject `disabled` props from TS router
Expected output:
<ButtonLinkdisabled// ->throw error ts, -> i want Omit this attributeisDisabled// -> valid, because props come from RAC>
Navigate
</ButtonLink>
However, even when custom link components explicitly omit disabled from their props interface, createLink() still injects it into the final component type, making it impossible to prevent at the TypeScript level.
Does library have solutions to support my case ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Integrating with component libraries like React Aria Components this is confusing which use
isDisabledinstead ofdisabledExpected output:
However, even when custom link components explicitly omit
disabledfrom their props interface, createLink() still injects it into the final component type, making it impossible to prevent at the TypeScript level.Does library have solutions to support my case ?
Beta Was this translation helpful? Give feedback.
All reactions