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

[milestone] Convert the library to typescript #4700

Open
26 of 29 tasks
mirus-ua opened this issue Apr 17, 2024 · 48 comments
Open
26 of 29 tasks

[milestone] Convert the library to typescript #4700

mirus-ua opened this issue Apr 17, 2024 · 48 comments

Comments

@mirus-ua
Copy link
Contributor

mirus-ua commented Apr 17, 2024

Contribution is welcome

Why?

Everything started here from the willing to merge a separate package with the corresponding type definitions into this repo.
The idea is great, but we, as a community, can go further and migrate the entire code base into typescript.

Any benefits?

  • only one package to install for end users
  • easier to maintain
  • your help to the lovely library
  • ???
  • profit

Our steps to achieve the goal

Modules to migrate and how to contribute

Basic rules and advice:

  • start with the smallest isolated modules, like calendar_container.jsx
  • prevent the use any or other loose types if you don't have strong arguments
  • prevent using "slow types", give this option to the end users
  • use interfaces instead of types because the large amount of the code base is class-based
  • add JSDocs where you can to improve overall DX. Everyone likes a good DX

Steps to contribute

  1. Write in the comments the name of the module that you want help to migrate
  2. Me or a maintainer will assign your name to the list to prevent doing the same job twice
  3. Migrate according to the list of advice above
  4. Highly recommended to migrate test cases together with the module
  5. Create a PR with a name format [typescript-migration] calendar.jsx etc.

Breaking changes so far:

  • newDate helper always returns a date, if the initial params were invalid, then it returns just a new Date Line; PR
  • calendarIconClassname => calendarIconClassName PR
@mirus-ua mirus-ua changed the title (draft)[milestone] Convert the library to typescript [milestone] Convert the library to typescript Apr 19, 2024
@mirus-ua
Copy link
Contributor Author

@martijnrusschen can you pin the issue?

@martijnrusschen
Copy link
Member

Nice progress so far!

@yuki0410-dev
Copy link
Contributor

@mirus-ua ( @martijnrusschen )
Thank you for the great attempt.
I would like to help as well, but should I declare the file to be started on this issue?

@yuki0410-dev
Copy link
Contributor

refs #4000

@martijnrusschen
Copy link
Member

@yuki0410-dev Feel free to claim a file and let it know here so there's no duplicate work done.

@mirus-ua
Copy link
Contributor Author

@yuki0410-dev hello
Yes, grab anything, the only one piece of advice is to pick modules without dependencies or with dependencies only on typescript modules, because it won't be pleasant to combine them later

@Olenka-Yurchuk
Copy link
Contributor

I would like to take the portal jsx file in work

@yuki0410-dev
Copy link
Contributor

I would like to take the week_number.jsx file in work

@mirus-ua
Copy link
Contributor Author

Added your name to week_number.jsx

@mirus-ua
Copy link
Contributor Author

6.6% 💪

Знімок екрана 2024-04-23 о 17 15 33

@yuki0410-dev
Copy link
Contributor

@mirus-ua
I would like to take the year_dropdown.jsx and year_dropdown_options.jsx file in work.

@yuki0410-dev
Copy link
Contributor

@mirus-ua
I would like to take the month_dropdown.jsx and month_dropdown_options.jsx file in work.

@mirus-ua
Copy link
Contributor Author

@martijnrusschen hello. Please ask reviews to look at four opened PRs if you can. It'll be much faster if we merge them because the rest of the modules depend on them

@martijnrusschen
Copy link
Member

Yep, I'll expect them to complete this soon. Normal turnaround time is ~2-4 hours.

@yuki0410-dev
Copy link
Contributor

@mirus-ua
I noticed during my experimentation with #4810 that type errors in the test file do not seem to result in errors in CI.
Is it my understanding that this is due to the fact that I am now using babel-jest to run tests with type information ignored, and that when I change to ts-jest later on, I will get CI errors?

@mirus-ua
Copy link
Contributor Author

@mirus-ua I noticed during my experimentation with #4810 that type errors in the test file do not seem to result in errors in CI. Is it my understanding that this is due to the fact that I am now using babel-jest to run tests with type information ignored, and that when I change to ts-jest later on, I will get CI errors?

everything is correct

@ryantanrk
Copy link
Contributor

hi, is anyone working on these files? i would like to take 1 of them:

calendar_test.test.js
datepicker_test.test.js
month_test.test.js

@martijnrusschen
Copy link
Member

@ryantanrk go for it :)

@ryantanrk
Copy link
Contributor

i'll take month_test.test.js then if no one is working on it 👍

@yuki0410-dev
Copy link
Contributor

@martijnrusschen @ryantanrk @mirus-ua
Converted calendar_test.test.js and datepicker_test.test.js.

@mirus-ua
Copy link
Contributor Author

mirus-ua commented Jun 2, 2024

What test modules are left?

@yuki0410-dev
Copy link
Contributor

@mirus-ua
#4855 is merged, TS conversion of all test modules is complete.

@martijnrusschen
Copy link
Member

Once #4855 is merged, I'll issue a major version upgrade. Are there any type/test changes we want to make once we're fully migrated to TS?

@martijnrusschen
Copy link
Member

The issue description says: after all, use ts-jest

@mirus-ua
Copy link
Contributor Author

mirus-ua commented Jun 2, 2024

Migrate to ts-jest and then go with the major

@martijnrusschen
Copy link
Member

martijnrusschen commented Jun 2, 2024 via email

@mirus-ua
Copy link
Contributor Author

mirus-ua commented Jun 3, 2024

OK. I'll do then

@mirus-ua
Copy link
Contributor Author

mirus-ua commented Jun 5, 2024

It looks like I underestimated the amount of work. Almost all tests have types issues, so I don't think that I can do it relatively fast alone

@martijnrusschen
Copy link
Member

Is this something that could be split up somehow?

@mirus-ua
Copy link
Contributor Author

mirus-ua commented Jun 5, 2024

Is this something that could be split up somehow?

I can push the branch with basic config, and then we can use it as PRs target for this activity

@martijnrusschen
Copy link
Member

sounds good

@mirus-ua
Copy link
Contributor Author

mirus-ua commented Jun 6, 2024

I'll do it today

UPD:

#4870

@yuki0410-dev
Copy link
Contributor

@mirus-ua
Just a thought, but if we assign the tests to ts-jest one file at a time in the transform section, can we migrate from babel-jest to ts-jest without causing errors in CI?

@mirus-ua
Copy link
Contributor Author

mirus-ua commented Jun 7, 2024

@mirus-ua Just a thought, but if we assign the tests to ts-jest one file at a time in the transform section, can we migrate from babel-jest to ts-jest without causing errors in CI?

Do you mean here explicitly add files that we migrated? It could work even if it'll be tedious

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

No branches or pull requests

5 participants