nextui-org / tailwind-variants

🦄 Tailwindcss first-class variant API
https://tailwind-variants.org
MIT License
2.42k stars 70 forks source link

Use `TVReturnType` to prevent circular references #39

Closed mskelton closed 1 year ago

mskelton commented 1 year ago

Description

The TypeScript types were behaving very slow and after some digging it was due to a circular reference from ReturnType<TV>. Swapping that out with TVReturnType drastically improves the experience in the editor.

There are a bunch of other issues with the types related to missing generic arguments and such that I plan on helping fix in future PRs, but wanted to get this out there since it's a small fix with a big performance improvement.

Additional context

The videos below show the difference in time for errors appearing before and after this change.

Before

https://user-images.githubusercontent.com/25914066/234464472-79fb3025-0448-48aa-bdee-43781b6c4111.mov

After

https://user-images.githubusercontent.com/25914066/234464481-0a6dbc7b-7c83-4e95-8ffb-260dd5ed75e5.mov

What is the purpose of this pull request?

Before submitting the PR, please make sure you do the following

jrgarciadev commented 1 year ago

Huge thanks! @mskelton 🚀