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] Generic date type #1966

Merged
merged 30 commits into from
Jul 10, 2020
Merged

[typescript] Generic date type #1966

merged 30 commits into from
Jul 10, 2020

Conversation

dmtrKovalenko
Copy link
Member

@dmtrKovalenko dmtrKovalenko commented Jul 9, 2020

This PR closes #1861 , and also closes #1962

User facing changes

All exported pickers components are generics from now. It means that it will try to infer the value and onChange(date: ?) type from the passed value. In order to get rid of @date-io/type and exported MaterialUIPickersDate which doesn't work starting from ts 3.9.

Internal changes

From now on actually all the internal props/arguments/variables that contain date value coming from date-io is handling as unknown. It is too hard and too verbose trying to make literally all the components generic. So basically using unknown type as a nice alternative, because we really don't know which type is coming from the user.

@vercel
Copy link

vercel bot commented Jul 9, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/mui-org/material-ui-pickers/dsjwqv7ts
✅ Preview: https://material-ui-pickers-git-feature-generic-value-type.mui-org.vercel.app

@cypress
Copy link

cypress bot commented Jul 9, 2020



Test summary

78 0 3 0


Run details

Project material-ui-pickers
Status Passed
Commit def5eaf
Started Jul 10, 2020 3:41 PM
Ended Jul 10, 2020 3:42 PM
Duration 01:46 💡
OS Linux Debian - 10.0
Browser Chrome 80

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests look solid :)

lib/src/DateRangePicker/DateRangePickerInput.tsx Outdated Show resolved Hide resolved
lib/src/DateRangePicker/DateRangePickerView.tsx Outdated Show resolved Hide resolved
lib/src/DateRangePicker/DateRangePickerViewDesktop.tsx Outdated Show resolved Hide resolved
lib/src/DateRangePicker/DateRangePickerViewMobile.tsx Outdated Show resolved Hide resolved
lib/src/DateTimePicker/DateTimePickerToolbar.tsx Outdated Show resolved Hide resolved
lib/src/views/Calendar/CalendarHeader.tsx Outdated Show resolved Hide resolved
lib/src/views/Calendar/Day.tsx Outdated Show resolved Hide resolved
lib/src/views/Calendar/MonthSelection.tsx Outdated Show resolved Hide resolved
lib/src/views/Calendar/YearSelection.tsx Outdated Show resolved Hide resolved
lib/src/views/Calendar/useCalendarState.tsx Outdated Show resolved Hide resolved
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview July 10, 2020 11:05 Inactive
dmtrKovalenko and others added 3 commits July 10, 2020 14:05
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview July 10, 2020 11:05 Inactive
dmtrKovalenko and others added 6 commits July 10, 2020 14:05
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview July 10, 2020 11:06 Inactive
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview July 10, 2020 11:49 Inactive
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview July 10, 2020 11:59 Inactive
dmtrKovalenko and others added 2 commits July 10, 2020 14:59
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview July 10, 2020 13:29 Inactive
@dmtrKovalenko dmtrKovalenko merged commit c3c4231 into next Jul 10, 2020
@dmtrKovalenko dmtrKovalenko deleted the feature/generic-value-type branch July 10, 2020 15:44
todor-a pushed a commit to todor-a/material-ui-pickers that referenced this pull request Jul 18, 2020
@@ -0,0 +1,79 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as React from 'react';
Copy link
Member

@oliviertassinari oliviertassinari Jul 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, how are these tests run in the CI (*.tstest.tsx files)? I can't find where it comes from. Is it just by using the same prefix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Replace MaterialUiPickersDate type with DateType TypeScript error with v4.0.0-alpha.10
2 participants