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
Appologies in advance, I'm sure the topic of TypeScript portable types is messy, but I was hoping since I've seen the team address this in other issues they might have ideas what could be going wrong.
I created a CustomButton component that extends the Base UI Button.
The inferred type of 'default' cannot be named without a reference to '../../../../../../../node_modules/@base-ui/react/esm/utils/types'. This is likely not portable. A type annotation is necessary.ts(2742)
Any ideas would be welcomed. Thank you 😄
Edit
I think because onClick and other event handlers use WithPreventBaseUIHandler this augments the type of event handlers. Which makes them not portable for consumers not directly importing Base UI. I think my options are to:
Undo the Base UI wrapped event handlers using only the Native React event handler types
Explicitly type the component with React.ComponentPropsWithoutRef<'button'> and only expose Base UI props I want consumers to know about.
Repro: https://stackblitz.com/edit/bf5bx4pd-epzkeps4?file=src%2Fbutton.tsx
Ask a question
Note
Appologies in advance, I'm sure the topic of TypeScript portable types is messy, but I was hoping since I've seen the team address this in other issues they might have ideas what could be going wrong.
I created a
CustomButtoncomponent that extends the Base UIButton.When consumers of
CustomButtonattempt to extend with their own implementation they receive a portablity issue.Any ideas would be welcomed. Thank you 😄
Edit
I think because
onClickand other event handlers useWithPreventBaseUIHandlerthis augments the type of event handlers. Which makes them not portable for consumers not directly importing Base UI. I think my options are to:React.ComponentPropsWithoutRef<'button'>and only expose Base UI props I want consumers to know about.