-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix(tsconfig): add exactOptionalPropertyTypes #97
fix(tsconfig): add exactOptionalPropertyTypes #97
Conversation
Why? |
I experimented some issues with 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"'. |
…onalPropertyTypes
@douglasduteil Thanks for the example. I updated the type decls to support |
ce86970
to
af6c701
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks perfect @mskelton :)
🎉 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
).