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

TypeScript build failure #579

Closed
2 tasks done
gadhlu02 opened this issue Mar 30, 2023 · 9 comments
Closed
2 tasks done

TypeScript build failure #579

gadhlu02 opened this issue Mar 30, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@gadhlu02
Copy link

Before you start - checklist

  • I followed instructions in documentation written for my React-Date-Picker version
  • I have checked if this bug is not already reported

Description

As we know react-date-picker uses react-calendar internally, and react-calendar has made a new release with version 4.1.0.
Because of that react-date-picker is not able to read the react-calender type props causing a build issue, this issue was not for react-calendar version 4.0.0.

Steps to reproduce

1)Install the latest version of react-date-picker
2)Try making react build out in your project
3)System will through a build issue as seen below

TS2322: Type '{ format: string; dayPlaceholder: string; monthPlaceholder: string; yearPlaceholder: string; "data-testid": any; openCalendarOnFocus: false; value: any; onChange: any; maxDate: Date; minDate: Date; }' is not assignable to type 'IntrinsicAttributes & DatePickerProps'.
Property 'value' does not exist on type 'IntrinsicAttributes & DatePickerProps'.
24 | data-testid={props.testId}
25 | openCalendarOnFocus={false}

26 | value={props?.value}
| ^^^^^
27 | onChange={props?.onChange}
28 | maxDate={dt}
29 | minDate={minDt}

Expected behavior

Build should be created without an error

Actual behavior

Not able to create a build

Additional information

No response

Environment

  • Browser (if applicable): Chrome
  • React-Date-Picker version:9.2.0
  • React version:18.2.0
@gadhlu02 gadhlu02 added the bug Something isn't working label Mar 30, 2023
@rossanodr
Copy link

I have the same problem with
Type error: Type '{ onChange: (...event: any[]) => void; value: Date; }' is not assignable to type 'IntrinsicAttributes & DatePickerProps'.
10:02:41.379

@MustacheTuanVu
Copy link

@types/react-calendar version 4.0.0 and above has issues. So I downgraded the version of react-date-picker from 9.2.0 to 8.4.0. react-date-picker 8.4.0 used @types/react-calendar version 3.0.0. Worked for me.

@sas6757
Copy link

sas6757 commented Apr 1, 2023

Similar problem

@wojtekmaj
Copy link
Owner

Sounds like a problem with React-Date-Picker types which seem to be incompatible with built-in, more accurate React-Calendar's one, causing build failure 🤔

@wojtekmaj wojtekmaj changed the title React Calender Prop Issue TypeScript build failure Apr 1, 2023
@wojtekmaj
Copy link
Owner

I think it's going to be solved once React-Date-Picker becomes native TypeScript as well.

@sas6757
Copy link

sas6757 commented Apr 1, 2023

And how long is the wait? Now I can’t put the latest version on the project, the component wrote on 9.0, but putting the same version on a new project, it gives this error, rolling back to version 8.4 - dist/entry.nostyle does not work

@wojtekmaj
Copy link
Owner

wojtekmaj commented Apr 1, 2023

I'm providing updates on my free time with unsustainable funding so well typed package will released anywhere between now and 6 months or so.

I'm trying to migrate all packages I have to TypeScript to prevent exactly that.

I'm assuming some kind of hotfix can be provided for the already shipped major version, like fixing handwritten types or pinning React-Calendar version to 4.0.

wojtekmaj added a commit that referenced this issue Apr 1, 2023
@wojtekmaj
Copy link
Owner

Pushed a hotfix in v9.2.1, let me know if that's resolved for you!

@sas6757
Copy link

sas6757 commented Apr 2, 2023

Thanks, it worked for me. If there is any error, I will write

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants