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

fix(tsconfig): add exactOptionalPropertyTypes #97

Conversation

douglasduteil
Copy link
Contributor

Description

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Follow the Style Guide.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

@mskelton
Copy link
Collaborator

Why?

@douglasduteil
Copy link
Contributor Author

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"'.

@mskelton mskelton marked this pull request as ready for review September 20, 2023 14:50
@mskelton
Copy link
Collaborator

@douglasduteil Thanks for the example. I updated the type decls to support exactOptionalPropertyTypes

@mskelton mskelton force-pushed the fix-tsconfig-add-exactOptionalPropertyTypes branch from ce86970 to af6c701 Compare September 20, 2023 14:53
Copy link
Contributor Author

@douglasduteil douglasduteil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect @mskelton :)

@mskelton mskelton enabled auto-merge October 14, 2023 19:30
@mskelton mskelton disabled auto-merge October 14, 2023 19:31
@mskelton mskelton requested review from jrgarciadev and removed request for jrgarciadev October 14, 2023 19:32
@mskelton mskelton merged commit 825ab59 into nextui-org:main Oct 24, 2023
4 checks passed
@douglasduteil douglasduteil deleted the fix-tsconfig-add-exactOptionalPropertyTypes branch October 24, 2023 15:45
@douglasduteil
Copy link
Contributor Author

🎉 Thanks @mskelton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants