primitives icon indicating copy to clipboard operation
primitives copied to clipboard

Can't import type PointerDownOutsideEvent

Open benlieb opened this issue 1 year ago • 2 comments

This type seems needed for onPointerDownOutside methods, but it is not exported in

@radix-ui/react-dismissable-layer/dist/index.d.ts

"@radix-ui/react-dismissable-layer": "1.0.4"

I solved it by creating my own type just as it was created in the file above...

benlieb avatar Oct 27 '23 18:10 benlieb

You can type onPointerDownOutside like

type ContentProps = React.ComponentProps<typeof SomeContentPrimitive>
type Props = {
  onPointerDownOutside: ContentProps['onPointerDownOutside']
}

joaom00 avatar Oct 31 '23 00:10 joaom00

This worked for me:

type PointerDownOutsideEvent = CustomEvent<{ originalEvent: PointerEvent; }>;

gregoryPacific avatar Feb 15 '24 17:02 gregoryPacific

We don't need to export the specific event type as it shouldn't be needed. If you are rewrapping the component, @joaom00's solution is what we would recommend.

benoitgrelard avatar Mar 05 '24 15:03 benoitgrelard