Closed douglasduteil closed 1 year ago
Why?
I experimented some issues with tailwind-variants
and this compiler options.
I'm wandering if the same errors hit the tailwind-variants
tests.
Some like :
import { tv, type VariantProps } from "tailwind-variants";
const button = tv({
variants: {
intent: {
primary: "bg-primary"
}
}
})
function DatButton({ intent }: VariantProps<typeof button>) {
return <button className={button({ intent })} />
}
Result with :
Type error: Argument of type '{ intent: "primary" | undefined; }' is not assignable to parameter of type '({ intent?: "primary" } & ClassProp<...>) | undefined'.
Type '{ intent: "primary" | undefined; }' is not assignable to type '{ intent?: "primary" } & { ...; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ intent: "primary" | undefined; }' is not assignable to type '{ intent?: "primary" }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'intent' are incompatible.
Type '"primary" | undefined' is not assignable to type '"primary"'.
Type 'undefined' is not assignable to type '"primary"'.
@douglasduteil Thanks for the example. I updated the type decls to support exactOptionalPropertyTypes
🎉 Thanks @mskelton
Description
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).