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

Type error on compoundVariants #2481

Closed
shareefhadid opened this issue Oct 28, 2024 · 1 comment
Closed

Type error on compoundVariants #2481

shareefhadid opened this issue Oct 28, 2024 · 1 comment
Labels
bug Something isn't working v3 #1289

Comments

@shareefhadid
Copy link

Environment

  • Operating System: Darwin
  • Node Version: v20.11.1
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Version

v3.0.0-alpha.7

Reproduction

export default defineAppConfig({
  ui: {
    colors: {
      neutral: "zinc",
      primary: "rose",
    },
    button: {
      compoundVariants: [
        {
          color: "neutral",
          variant: "outline",
          class:
            "ring ring-inset ring-[var(--ui-border-accented)] text-[var(--ui-text)] bg-[var(--ui-bg)] hover:bg-[var(--ui-bg-elevated)] disabled:bg-[var(--ui-bg)] aria-disabled:bg-[var(--ui-bg)] focus-visible:ring-2 focus-visible:ring-[var(--ui-border-inverted)]",
        },
      ],
    },
  },
});
Type '{ color: "neutral"; variant: "outline"; class: string; }[]' is not assignable to type 'DeepPartial<({ color: "primary"; variant: "solid"; class: string; size?: undefined; square?: undefined; loading?: undefined; leading?: undefined; trailing?: undefined; } | { color: "secondary"; variant: "solid"; ... 5 more ...; trailing?: undefined; } | ... 46 more ... | { ...; })[], string>'.
  Type '{ color: "neutral"; variant: "outline"; class: string; }[]' is not assignable to type '{ [key: string]: string | TightMap<string>; }'.
    Index signature for type 'string' is missing in type '{ color: "neutral"; variant: "outline"; class: string; }[]'.ts(2322)

Description

Hi :) I am getting type errors when using compoundVariant.

For example, here is my app.config.ts:

export default defineAppConfig({
  ui: {
    colors: {
      neutral: "zinc",
      primary: "rose",
    },
    button: {
      compoundVariants: [
        {
          color: "neutral",
          variant: "outline",
          class:
            "ring ring-inset ring-[var(--ui-border-accented)] text-[var(--ui-text)] bg-[var(--ui-bg)] hover:bg-[var(--ui-bg-elevated)] disabled:bg-[var(--ui-bg)] aria-disabled:bg-[var(--ui-bg)] focus-visible:ring-2 focus-visible:ring-[var(--ui-border-inverted)]",
        },
      ],
    },
  },
});

I am getting the following type error for compoundVariants:

Type '{ color: "neutral"; variant: "outline"; class: string; }[]' is not assignable to type 'DeepPartial<({ color: "primary"; variant: "solid"; class: string; size?: undefined; square?: undefined; loading?: undefined; leading?: undefined; trailing?: undefined; } | { color: "secondary"; variant: "solid"; ... 5 more ...; trailing?: undefined; } | ... 46 more ... | { ...; })[], string>'.
  Type '{ color: "neutral"; variant: "outline"; class: string; }[]' is not assignable to type '{ [key: string]: string | TightMap<string>; }'.
    Index signature for type 'string' is missing in type '{ color: "neutral"; variant: "outline"; class: string; }[]'.ts(2322)

Additional context

No response

Logs

No response

@shareefhadid shareefhadid added bug Something isn't working triage v3 #1289 labels Oct 28, 2024
benjamincanac added a commit that referenced this issue Oct 28, 2024
@benjamincanac benjamincanac removed the triage label Oct 28, 2024 — with Volta.net
Copy link
Member

Thanks for the report! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v3 #1289
Projects
None yet
Development

No branches or pull requests

2 participants