Shopify / restyle

A type-enforced system for building UI components in React Native with TypeScript.
https://shopify.github.io/restyle/
MIT License
2.95k stars 133 forks source link

Update variants.md #277

Closed ustuncem closed 6 months ago

ustuncem commented 12 months ago

Description

Based on this issue there is a typescript problem that throws an error on trying to create a variant. In the issue there was a fix indicating that if we specify the name of the key like:

const variant = createVariant<Theme, 'buttonVariants'>({ themeKey: 'buttonVariants', defaults: { margin: 'm', }, })

the ts error goes away. I updated the docs because this caused me a 1 day delay to search and fix.

colinta commented 6 months ago

Addressed in https://github.com/Shopify/restyle/pull/292