-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
refactor: Add TypeScript support #1985
Conversation
I will reformat the title to use the proper commit message syntax. |
Thanks for opening this pull request! |
@dplewis I have added you to my repo if you would like to contribute. I'm not sure how we can resolve the typescript issues without making large changes to the codebase. The issue seems to be that one file depends on invalid ts, and when that file is fixed, it depends on another file with invalid ts, and so forth. @mtrezza? |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## alpha #1985 +/- ##
==========================================
- Coverage 99.88% 99.88% -0.01%
==========================================
Files 61 61
Lines 6143 6117 -26
Branches 1491 1491
==========================================
- Hits 6136 6110 -26
Misses 7 7
☔ View full report in Codecov by Sentry. |
@dblythy I have no problem reviewing large changes. This PR is just syntactic sugar without any functionality. |
Can we also have a TS test in the CI that ensures that the parts of the code that are already converted to TS are type-correct? Otherwise we'll have a hard time reviewing the incremental TS PRs. |
@dblythy @mtrezza For this to work you need to fix the test suite and treat it like the unit tests. Bypass the
instead of
|
I was referring to the CI job that currently fails, the |
@dblythy I only changed Parse.ts and ParseSession.ts. Here are the steps if you want to convert other files.
|
@dblythy I used allowJs to generate all the typings available with a ts-no-check to remove warnings. Regenerating the typings would remove the no-check, I set it up to prevent that and allow for incremental regeneration by adding files to tsconfig. index.d.ts shouldn’t be changed for now as every release will have some typing like DefinitelyTyped |
@mtrezza I think this is ready for review |
Nice, the checks pass. @dblythy What do you think? So these are the instructions for incrementally convert to TS? If so, I'll copy them to #1950, so we have that documented for contributors.
What does that mean? Is there anything new we need to consider when reviewing PRs? If so, could you amend the instructions with what not to do, so it also serves as guideline for reviewers? |
To be honest I don't use typescript and never published a typescript package. I don't think users will have to install Instructions have been updated. |
That's good point. We know that |
We would remove the package from DefinitelyTyped to avoid confusion. |
Would it make sense to accept TS conversion PRs but not publish the type files on NPM just yet, i.e. not include them in the published npm package, only keep them in the GitHub repo? We could wait until we have reached a good level of TS conversion so that developers won't loose the current level of type coverage so drastically. |
Since index.d.ts is copied directly from DefinitelyTyped no coverage is loss. As far as publishing to npm, we should plan for the next major release of the SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good; maybe someone else could take a look at this as well before we merge? @dblythy @sadortun @radandevist
I think we can leave this open for another 2 days; if there are no opposing reviews we'll go ahead and merge. |
e001e7c
to
b59b111
Compare
We should change the title of the PR to
There are a few reasons why I specifically chose ParseSession to be the first file to convert to TypeScript. It has few functions and the limited dependencies it uses are the most important in the project. Its a good place to start since we are about to go down a typing rabbit hole. |
Sounds good - apologies, I'll revert my changes |
This reverts commit b59b111.
LGTM ✅ Thanks @dplewis |
Great to see this is ready for merge; just one last thing: it's unclear what "initial TypeScript support" is supposed to mean. Instead of adding "initial", if we want to communicate anything specific, we can spell it out in the changelog. I can amend the changelog entry in the commit message, so we don't have to write an unreadably-long PR title. Could someone compose a short sentence what we mean by "initial"? |
These are internal changes with no effect on the developers yet. Nothing much to communicate unless to you want to show TS progress through changelogs. We can treat this the same as CI changes. |
Then this should not be a Please confirm that this is correct and I'll go ahead and merge. |
@mtrezza LGTM! |
🎉 This change has been released in version 4.2.0-alpha.5 |
🎉 This change has been released in version 4.3.0-beta.1 |
🎉 This change has been released in version 4.3.0-alpha.1 |
🎉 This change has been released in version 4.3.0 |
Pull Request
Issue
Closes: #1950
Approach
Tasks