Upgrade to TypeScript 5
ts-patch (the successor of ttypescript) has released a beta which adds support for TypeScript 5 and asked consumers to test it. In this branch, I've confirmed that this library works with the new version of ts-patch.
I've:
- Replaced
ttypescriptwithts-patch(sincettypescriptis not being developed anymore). - Fixed a type-narrowing-related bug in
useEventListenerthat appeared with TypeScript 5.
This can be merged later, when the release version of ts-patch is available. I'll also format the commit messages then.
There is one thing i dont like about ts-patch - in some kind ts-patch breaks typecript itself - it is not something built around typescript like ttypescript, it injects into TS itself.
Otherwise - we're not in hurry here. TS 5 broken lots of things out there, i wast even able to switch any of projects at work, bcause of incompatibility.
There is one thing i dont like about
ts-patch- in some kindts-patchbreaks typecript itself - it is not something built around typescript likettypescript, it injects into TS itself.
The question I would ask now is: could we get rid of the dependency altogether? Is ttypescript really necessary?
Weeelp, with some tinkering around linting (that will enforce .js extension within imports) and TS configs - it is possible to get rid of plugins now. It was not, at the moment ttsc been introduced to our repos.
And maybe you're right.
Better move will be to get rid of plugins alltogether. It will require changing all imports and, i think, switch module resolution to ESNext (or maybe NodeNext)
And maybe you're right. Better move will be to get rid of plugins alltogether. It will require changing all imports and, i think, switch module resolution to
ESNext(or maybe NodeNext)
Sounds good. I'm totally up for committing time to this.
I upgraded TypeScript, removed ttypescript, replaced ttsc with tsc in build scripts, changed module resolution to NodeNext and everything appears to work now.
Codecov Report
Merging #1194 (9af3992) into master (284e499) will decrease coverage by
0.10%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #1194 +/- ##
==========================================
- Coverage 98.49% 98.40% -0.10%
==========================================
Files 62 62
Lines 1064 1064
Branches 179 179
==========================================
- Hits 1048 1047 -1
- Misses 2 3 +1
Partials 14 14
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/useEventListener/index.ts | 100.00% <100.00%> (ø) |
... and 1 file with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
🤔 does it generate files that have .js imports?
im pretty much surprised that it dont require.js extension in imports
Well that was the point of plugin We have to enforce extensions otherwise esm won't work.
The imports and requires of the generated files don't have any extensions (deleted the previous comment, because I built the wrong branch).
Interesting. I guess we'll have to go with ts-patch then? ttypescript and such won't work with TypeScript 5.
Nope Just enforce it on linter level.
maybe we have to consider finally switch to "type": "module".
As for me we finally migrated all our production services to native esm.
so here's the plan.
- process current PR's
- migrate to new hooks testing library (
@testing-library/react-hooks->@testing-library/react) - migrate to type: module
- migrate from storybook to docosurus (supposedly, not sure yet if docosaurus is viable with our directorues structure)