[koa] Add v2 types#74990
Conversation
|
@unrevised6419 Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through. This is a live comment that I will keep updated. This PR touches some part of DefinitelyTyped infrastructure, so a DT maintainer will need to review it. This is rare — did you mean to do this? 1 package in this PR (and infra files)
Code ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. You can test the changes of this PR in the Playground. Status
All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 74990,
"author": "unrevised6419",
"headCommitOid": "11fda3790e538c0f90289a89c635f0b9a01d3bd5",
"mergeBaseOid": "3c0b15fc1e4e9a3ab449e463673b3c33355c9e85",
"lastPushDate": "2026-05-12T18:23:14.000Z",
"lastActivityDate": "2026-05-14T20:20:29.000Z",
"mergeOfferDate": "2026-05-14T19:56:00.000Z",
"mergeRequestDate": "2026-05-14T20:20:29.000Z",
"mergeRequestUser": "unrevised6419",
"hasMergeConflict": false,
"isFirstContribution": true,
"tooManyFiles": false,
"hugeChange": false,
"tooManyCommits": false,
"tooManyReviews": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": null,
"kind": "edit",
"files": [
{
"path": "attw.json",
"kind": "infrastructure"
}
],
"owners": [],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical",
"isSafeInfrastructureEdit": false
},
{
"name": "koa",
"kind": "edit",
"files": [
{
"path": "types/koa/.npmignore",
"kind": "package-meta-ok"
},
{
"path": "types/koa/v2/.eslintrc.json",
"kind": "package-meta",
"suspect": "not [the expected form](https://github.com/DefinitelyTyped/DefinitelyTyped#user-content-linter-eslintrcjson) (check: `rules`)"
},
{
"path": "types/koa/v2/.npmignore",
"kind": "package-meta-ok"
},
{
"path": "types/koa/v2/index.d.ts",
"kind": "definition"
},
{
"path": "types/koa/v2/package.json",
"kind": "package-meta-ok"
},
{
"path": "types/koa/v2/test/constructor.ts",
"kind": "test"
},
{
"path": "types/koa/v2/test/default.ts",
"kind": "test"
},
{
"path": "types/koa/v2/test/index.ts",
"kind": "test"
},
{
"path": "types/koa/v2/test/settings.ts",
"kind": "test"
},
{
"path": "types/koa/v2/test/typed-response-body.ts",
"kind": "test"
},
{
"path": "types/koa/v2/tsconfig.json",
"kind": "package-meta-ok"
}
],
"owners": [
"jkeylu",
"brikou",
"harryparkdotio",
"chatoo2412",
"tellnes",
"pkuczynski",
"vnoder"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "jakebailey",
"date": "2026-05-14T19:55:20.000Z",
"isMaintainer": true
},
{
"type": "stale",
"reviewer": "pkuczynski",
"date": "2026-05-12T18:51:41.000Z",
"abbrOid": "c7f51d7"
}
],
"mainBotCommentID": 4433490854,
"ciResult": "pass"
} |
|
🔔 @jkeylu @brikou @harryparkdotio @chatoo2412 @tellnes @pkuczynski @vnoder — please review this PR in the next few days. Be sure to explicitly select |
eebe69e to
5aaaabe
Compare
5aaaabe to
c7f51d7
Compare
|
This code doesn't match what's in https://app.unpkg.com/@types/koa@2.15.0; the import syntax is different and the dependencies are different. Is that all intentional? |
|
Let me do some more tests locally on https://github.com/strapi/strapi I'm installing it locally directly from the path, but I guess there should be some process for release, or how can I pack it locally? |
|
You can run |
|
Tried |
|
I'll try to see how I can do a "real" pack locally using https://github.com/microsoft/DefinitelyTyped-tools/tree/main/packages/publisher |
|
The publisher just builds the tarball directly from the source. I'm not sure what you're missing, but in the published package, it's: import * as accepts from "accepts";
import { AsyncLocalStorage } from "async_hooks";
import * as Cookies from "cookies";
import { EventEmitter } from "events";
import { IncomingHttpHeaders, IncomingMessage, OutgoingHttpHeaders, Server, ServerResponse } from "http";
import { Http2ServerRequest, Http2ServerResponse } from "http2";
import httpAssert = require("http-assert");
import * as contentDisposition from "content-disposition";
import * as HttpErrors from "http-errors";
import * as Keygrip from "keygrip";
import * as compose from "koa-compose";
import { ListenOptions, Socket } from "net";
import { ParsedUrlQuery } from "querystring";
import * as url from "url";But here, you've written: import accepts = require("accepts");
import { AsyncLocalStorage } from "async_hooks";
import Cookies = require("cookies");
import { EventEmitter } from "events";
import { IncomingHttpHeaders, IncomingMessage, OutgoingHttpHeaders, Server, ServerResponse } from "http";
import { Http2ServerRequest, Http2ServerResponse } from "http2";
import httpAssert = require("http-assert");
import contentDisposition = require("content-disposition");
import HttpErrors = require("http-errors");
import Keygrip = require("keygrip");
import compose = require("koa-compose");
import { ListenOptions, Socket } from "net";
import { ParsedUrlQuery } from "querystring";
import * as url from "url";Differences can be okay, I am just asking for an explanation. |
|
It seems these changes were made by the DefinitelyTyped maintainers in 9a370b0#diff-bb94074d9ae1164d531dd6eb17a8858f06f4129662469a7d5e1dd19cb5eed86c (see files in Should I revert them back to what was in 2.15.0? I'll do some more tests tomorrow. |
|
I see. I am unsure why that was not published to npm. What about the package.json diff? |
|
That DefinitelyTyped core change was made after the koa v3 types release, that's why it did not land in v2 Will revert the package.json diff also. I suppose it needs to be |
|
That'll end up picking an arbitrary one, and then likely the latest, so you should just check koa v2 upstream to see what they use. |
|
Ok. Will do so. Strange why previously all versions were |
|
Question: Why all of the |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c7f51d7 to
11fda37
Compare
|
I did revert the package.json to be exactly as it was in Using current PR and this one #74991 |
|
@pkuczynski Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review? |
|
@unrevised6419: Everything looks good here. I am ready to merge this PR (at 11fda37) on your behalf whenever you think it's ready. If you'd like that to happen, please post a comment saying:
and I'll merge this PR almost instantly. Thanks for helping out! ❤️ (@jkeylu, @brikou, @harryparkdotio, @chatoo2412, @tellnes, @pkuczynski, @vnoder: you can do this too.) |
|
Ready to merge |
Adds
types/koa/v2to provide type definitions for the still-supported Koa v2.x line, alongside the existing v3 types intypes/koa.Method
types/koa/v2was created by copying the currenttypes/koa(v3) and reverting only the v3-related changes. Since v2 existed, four commits touchedtypes/koa:7eb661e— Update @types/koa to match koa version 3 — reverted9a370b0— Make all packages work withesModuleInterop— kept (infra)2f29f0c— Fix packages for TS 6.0strict=true— kept (infra)c19b4e9— add customAsyncLocalStoragesupport toApplicationconstructor — reverted (v3-only API)package.jsonset to2.15.9999; deps pinned to v2-compatible versions.Checklist
pnpm test koa.If changing an existing definition:
package.json.