tailwindlabs / headlessui

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
https://headlessui.com
MIT License
25.02k stars 1.03k forks source link

Fix issues spreading omitted props onto components #3313

Closed thecrypticace closed 1 week ago

thecrypticace commented 1 week ago

The existing PropsForFeatures type is meant to enable mutually exclusive props.

A component may accept static and unmount but may not accept both simultaneously. We encoded this in the typescript types but it's causing more problems than it solves. For example, Omit<ComponentProps, 'className'> can't be spread back onto the component.

So this basically replaced the three cases with the following:

  1. { static?: boolean }
  2. { unmount?: boolean }
  3. { static?: boolean, unmount?: boolean }

This makes TypeScript much happier about the types and should help typeschecking performance too.

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 5:53pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2024 5:53pm