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

Props being inferred as any since v7 #5042

Open
cascornelissen opened this issue Aug 21, 2024 · 0 comments
Open

Props being inferred as any since v7 #5042

cascornelissen opened this issue Aug 21, 2024 · 0 comments

Comments

@cascornelissen
Copy link

Describe the bug
A number of props are inferred as any after updating react-datepicker to v7. This makes it impossible to extend the DatePicker component's props for a component that renders a DatePicker.

To Reproduce
Install react-datepicker v7 (7.3.0 at the moment of writing) and let TypeScript infer types for props that are not directly configured in the DatePickerProps interface.

import React from 'react';
import DatePicker, { DatePickerProps } from 'react-datepicker';

// These get inferred as `any`
type A = React.ComponentProps<typeof DatePicker>['minDate'];
type B = DatePickerProps['maxDate'];
type C = DatePickerProps['dateFormatCalendar'];

// These work
type D = DatePickerProps['open'];

Expected behavior
The type is correctly inferred.

Screenshots
image
image

Additional context
TypeScript 5.5.4

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