[x] I have ensured my pull request is not behind the main or master branch of the original repository.
[x] I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
[x] I have written a commit message that passes commitlint linting.
[x] I have ensured that my code changes pass linting tests.
[x] I have ensured that my code changes pass unit tests.
[x] I have described my pull request and the reasons for code changes along with context if necessary.
I had converted koa to TS last year as a bit of a learning exercise and the thought of having my own custom TS framework, but I ended up not using it.
When I saw koa was open to a TS rewrite for v3, I decided to dust this off.
Its an attempt to keep the v2 koa code as close to untouched as possible while:
Making koa esm only
Writing koa completely in strictly typed TS with type aware linting on
Absolutely minimal changing the JS code
pass all tests with minimal changes to the tests
In addition, I also wrote it with xo as the linter, I was going to attempt to convert to ts-standard, but it was going to be a pain in the butt, so I just made xo lint ts files and kept standard the linter for js files.
The tests remain in js and they test the TS build output.
The lazy import of async_hooks and version error has been removed.
The test of the ESM conversion was removed since its ESM only here.
One thing of note is that these types are not compatible with the current definitely typed ts types.
EDIT: also note all the tests are passing in each node version, but there is a problem with experimental code cov or something, and node 20 has some known issues with sourcemaps causing issues.
Checklist
I had converted
koa
to TS last year as a bit of a learning exercise and the thought of having my own custom TS framework, but I ended up not using it.When I saw koa was open to a TS rewrite for v3, I decided to dust this off.
Its an attempt to keep the v2 koa code as close to untouched as possible while:
In addition, I also wrote it with
xo
as the linter, I was going to attempt to convert to ts-standard, but it was going to be a pain in the butt, so I just made xo lint ts files and kept standard the linter for js files.The tests remain in js and they test the TS build output.
One thing of note is that these types are not compatible with the current definitely typed ts types.
EDIT: also note all the tests are passing in each node version, but there is a problem with experimental code cov or something, and node 20 has some known issues with sourcemaps causing issues.