Skip to content

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

Open
@junhaoliao

Description

@junhaoliao

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions