react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

chore: suggested improvements for useDialog types

Open venikx opened this issue 2 years ago • 0 comments

Suggestion for https://github.com/adobe/react-spectrum/discussions/1618#discussioncomment-396010 Would this be a possibiliy to keep the wide types, while still offering a possibility to make them narrower? It also "solves" the issue when HTMLElement being incompatible when react-aria has different @types/react than the application.

📝 Test Instructions:

const Test = (props: { onClose: () => void, isDismissable: boolean, id: string }) => {
  const ref = useRef()
  const { dialogProps, titleProps } = useDialog<HTMLDivElement, HTMLHeadElement>(props, ref);
  // sets it as a more specific element
  // however useDialog(props, ref) also keeps working
  return (
    <div { ...dialogProps } > <h4>Keker < /h4>{props.children}</div >
    )
}

🧢 Your Project:

Private repository

venikx avatar Jul 07 '22 19:07 venikx