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
[@types/express-ws] Correct incorrect typing for websocket in express-ws types #69518
base: master
Are you sure you want to change the base?
Conversation
Minor type fix
@yashsavalia1 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 which I will keep updated. 1 package in this PRCode ReviewsThis PR can be merged once it's reviewed by a DT maintainer. You can test the changes of this PR in the Playground. Status
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 69518,
"author": "yashsavalia1",
"headCommitOid": "7d6f6b4095bc243912c4130bdbf185c29717f0d9",
"mergeBaseOid": "7c8a70dc1588bcebeb86c61c3b987e474853b451",
"lastPushDate": "2024-05-04T11:53:48.000Z",
"lastActivityDate": "2024-05-16T16:38:20.000Z",
"hasMergeConflict": false,
"isFirstContribution": true,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Popular",
"pkgInfo": [
{
"name": "express-ws",
"kind": "edit",
"files": [
{
"path": "types/express-ws/index.d.ts",
"kind": "definition"
}
],
"owners": [
"ajliv"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Popular"
}
],
"reviews": [
{
"type": "changereq",
"reviewer": "sandersn",
"date": "2024-05-16T16:38:20.000Z"
}
],
"mainBotCommentID": 2094385245,
"ciResult": "pass"
} |
Hey @yashsavalia1, 😒 Your PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Please consider adding tests to cover the change you're making. Including tests allows this PR to be merged by yourself and the owners of this module. This can potentially save days of time for you! |
🔔 @ajliv — please review this PR in the next few days. Be sure to explicitly select |
Re-ping @ajliv: This PR has been out for over a week, yet I haven't seen any reviews. Could someone please give it some attention? Thanks! |
} | ||
|
||
type WebsocketRequestHandler = (ws: ws, req: express.Request, next: express.NextFunction) => void; | ||
type WebsocketRequestHandler = (ws: ws.WebSocket, req: express.Request, next: express.NextFunction) => void; |
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.
ws
is a synonym of ws.WebSocket
, although I think the new code is easier to understand.
@@ -31,10 +31,10 @@ declare namespace expressWs { | |||
interface Instance { | |||
app: Application; | |||
applyTo(target: RouterLike): void; | |||
getWss(): ws.Server; | |||
getWss(): ws.WebSocketServer; |
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.
ws
defines WebSocketServer
as a synonym of Server
by declaring a const
and an interface
. What's the advantage of switching? Based only on the types, I'd prefer Server
since it's the original. But I know nothing about ws
except what I got from reading index.d.ts.
@yashsavalia1 One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you! |
Correct incorrect typing for websocket in express-ws types
Please fill in this template.
pnpm test <package to test>
.Select one of these and delete the others:
If adding a new definition:
.d.ts
files generated via--declaration
dts-gen --dt
, not by basing it on an existing project.tsconfig.json
should havenoImplicitAny
,noImplicitThis
,strictNullChecks
, andstrictFunctionTypes
set totrue
.If changing an existing definition:
package.json
.If removing a declaration:
notNeededPackages.json
.