Skip to content

TypeScript Type Error When Using rc-select with CSS Modules and Vite. #1143

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

Open
junhaoliao opened this issue Apr 10, 2025 · 0 comments
Open

Comments

@junhaoliao
Copy link

junhaoliao commented Apr 10, 2025

When using rc-select with CSS Modules and Vite, the following error occurs with exactOptionalPropertyTypes: true enabled:

CSS Module:

/* myStyles.module.css */
.selectBox {
  /* styles */
}

Component:

import styles from "myStyles.module.css"

const MyComponent = () => (
  <Select className={styles["selectBox"]} />
);

Error:

TS2375: Type { className: string | undefined; } is not assignable to type SelectProps<any, DefaultOptionType> with 'exactOptionalPropertyTypes: true'. Consider adding undefined to the types of the target's properties.
Types of property className are incompatible.
Type string | undefined is not assignable to type string
Type undefined is not assignable to type string
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

No branches or pull requests

1 participant