Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update variants.md #277

Closed
wants to merge 1 commit into from
Closed

Update variants.md #277

wants to merge 1 commit into from

Conversation

ustuncem
Copy link

@ustuncem ustuncem commented Oct 9, 2023

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.

@@ -49,7 +49,7 @@ const theme = createTheme({

import {createVariant, createRestyleComponent, VariantProps} from '@shopify/restyle'
import {Theme} from './theme';
const variant = createVariant<Theme>({themeKey: 'cardVariants', defaults: {
const variant = createVariant<Theme, 'cardVariant'>({themeKey: 'cardVariants', defaults: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const variant = createVariant<Theme, 'cardVariant'>({themeKey: 'cardVariants', defaults: {
const variant = createVariant<Theme, 'cardVariants'>({themeKey: 'cardVariants', defaults: {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is a typo

@colinta
Copy link
Contributor

colinta commented Mar 11, 2024

Addressed in #292

@colinta colinta closed this Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants