busbud / tailwind-buddy

Tailwind Buddy: Your Friendly Helper for Composing Tailwind Classes 🎨
https://busbud.github.io/tailwind-buddy/
12 stars 1 forks source link

Interface extension improvments #8

Closed chekromul closed 2 months ago

chekromul commented 4 months ago

Preconditions

"@busbud/tailwind-buddy": "^0.0.33"

Steps to reproduce

import { VariantsProps, compose } from "@busbud/tailwind-buddy";

interface FooBaseProps {
  someProp?: string;
}

const fooVariants = compose({
  slots: {
    root: "",
  },
  variants: {
    size: {
      md: {
        root: "text-size-150"
      },
    },
  },
  defaultVariants: {
    size: "md",
  },
  responsiveVariants: [],
})<FooBaseProps>();

type FooProps = VariantsProps<typeof fooVariants>;

export interface BarProps extends FooProps {}

Actual result

Here's the error:

TS2312: An interface can only extend an object type or intersection of object types with statically known members.

Screenshot
flozero commented 2 months ago

Its not something we do as we do need to type inside the variant definition the compound.

Thats the main difference with other libraries they don't support compound conditions with other props than the variants