Skip to content

Incorrect Typescript example for RecipeVariantProps #2904

Description

@jorqensen

Subject

TypeScript guide for recipe variants

Description

Seems to be a mistake in the docs regarding RecipeVariantProps.

Using RecipeVariantProps results in this type:

type ButtonVariants = {
    visual?: "primary" | "secondary" | undefined;
} | undefined

Which is not the expected type, according to the documentation:

// { size?: 'small' | 'large' }

However, using RecipeVariant gives an output closer to what is "expected":

type ButtonVariants = {
    visual: "primary" | "secondary";
}

The type still doesn't mark the visual as optional, as the docs reference. Seems to be expected behavior according to #2182 however.

Could we update the docs to either mention RecipeVariant or both with examples? If a PR is needed, let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions