picker icon indicating copy to clipboard operation
picker copied to clipboard

TypeScript error in SinglePickerPanelProps interface during build process

Open chaiwei opened this issue 1 year ago • 4 comments

Reproduction link

Edit SinglePickerPanelProps

Steps to Reproduce:

  • Open the reproduction link in CodeSandbox
  • Navigate to the build terminal
  • Trigger the build process
  • Observe the TypeScript error encountered during the build process.

What is Expected?

The build process should complete successfully without encountering any TypeScript errors.

What is Actually Happening?

During the build process, the TypeScript error TS2430 occurs in the file node_modules/rc-picker/lib/PickerPanel/index.d.ts.

node_modules/rc-picker/lib/PickerPanel/index.d.ts:40:18 - error TS2430: Interface 'SinglePickerPanelProps<DateType>' incorrectly extends interface 'BasePickerPanelProps<DateType>'.
  Types of property 'defaultValue' are incompatible.
    Type 'DateType | null | undefined' is not assignable to type 'DateType | undefined'.
      Type 'null' is not assignable to type 'DateType | undefined'.

40 export interface SinglePickerPanelProps<DateType extends object = any> extends BasePickerPanelProps<DateType> {
                    ~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in node_modules/rc-picker/lib/PickerPanel/index.d.ts:40

Additional Comments:

Dependency Version
antd 5.14.1
dayjs 1.11.10
react ^18.2.0
react-dom ^18.2.0

chaiwei avatar Feb 23 '24 06:02 chaiwei

any solution?

RickieWoo avatar Mar 15 '24 03:03 RickieWoo

You can ignore the error by adding "skipLibCheck": true to your compilerOptions in your tsconfig.json file.

"compilerOptions": {
    // ... the remaining options
    "skipLibCheck": true,
}

This will skip type checking of declaration files, which might resolve the TypeScript error you're encountering.

chaiwei avatar Mar 15 '24 12:03 chaiwei