nandorojo / dripsy

🍷 Responsive, unstyled UI primitives for React Native + Web.
https://dripsy.xyz
MIT License
1.98k stars 77 forks source link

Fixed Sx type: added support of predefined aliases #294

Open v-honcharenko opened 1 year ago

v-honcharenko commented 1 year ago

Hi @nandorojo

First of all, thank you for your work on this great project!

I found a typing issue with the Sx prop related to aliases. For now, only the aliases of theme-ui are allowed by TS (bg, m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, size), all other defined aliases (like h, w, br) are not exposed to Sx type, and TS will complain when you will try to use it, however aliasing will work.

This PR fixes this issue, allowing to use TS intellisense for predefined aliases.

vercel[bot] commented 1 year ago

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

Name Status Preview Comments Updated (UTC)
dripsy ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2023 1:11am
nandorojo commented 9 months ago

Hey, you can use the aliases field on the theme to inject your own aliases too. Would that suffice to solve this?

v-honcharenko commented 9 months ago

@nandorojo the issue is related only to typings of built-in aliases. All of these aliases are valid in JS code, and even in TS code it will work, BUT, TypeScript will complain on it, because these types are missed (only types, not aliases). This PR fixes that.