feat(ws): Add support for custom WebSocket#58772
feat(ws): Add support for custom WebSocket#58772typescript-bot merged 13 commits intoDefinitelyTyped:masterfrom
Conversation
|
@mglyzin 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 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": 58772,
"author": "mglyzin",
"headCommitOid": "cccf5155aa3d61140291ecff2638e403739908c3",
"mergeBaseOid": "45437334b53ce6497e12eaef0ed98a31024101cc",
"lastPushDate": "2022-02-23T21:30:22.000Z",
"lastActivityDate": "2022-02-24T21:35:43.000Z",
"mergeOfferDate": "2022-02-24T21:27:41.000Z",
"mergeRequestDate": "2022-02-24T21:35:43.000Z",
"mergeRequestUser": "k-yle",
"hasMergeConflict": false,
"isFirstContribution": true,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "ws",
"kind": "edit",
"files": [
{
"path": "types/ws/index.d.ts",
"kind": "definition"
},
{
"path": "types/ws/ws-tests.ts",
"kind": "test"
}
],
"owners": [
"loyd",
"mlamp",
"TitaneBoy",
"reduckted",
"teidesu",
"wojtkowiak",
"k-yle",
"cwadrupldijjit"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [
{
"type": "approved",
"reviewer": "k-yle",
"date": "2022-02-24T21:30:27.000Z",
"isMaintainer": false
},
{
"type": "approved",
"reviewer": "jakebailey",
"date": "2022-02-24T21:27:03.000Z",
"isMaintainer": true
},
{
"type": "approved",
"reviewer": "vansergen",
"date": "2022-02-24T07:07:19.000Z",
"isMaintainer": false
},
{
"type": "approved",
"reviewer": "jlalmes",
"date": "2022-02-23T22:24:43.000Z",
"isMaintainer": false
}
],
"mainBotCommentID": 1039195200,
"ciResult": "pass"
} |
|
🔔 @loyd @mlamp @TitaneBoy @reduckted @teidesu @wojtkowiak @k-yle @cwadrupldijjit — please review this PR in the next few days. Be sure to explicitly select |
| ws; | ||
| // $ExpectType "foo" | ||
| ws.foo(); | ||
| }); |
There was a problem hiding this comment.
| }); | |
| }); | |
| webSocketServer.clients.forEach((ws) => { | |
| // $ExpectType CustomWebSocket | |
| ws; | |
| // $ExpectType "foo" | |
| ws.foo(); | |
| }); |
|
@mglyzin The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
|
@mglyzin The CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review. |
| ws.foo(); | ||
| }); | ||
| webSocketServer.clients.forEach((ws) => { | ||
| Array.from(webSocketServer.clients).forEach((ws) => { |
There was a problem hiding this comment.
for future reference:
ERROR: 332:1 expect TypeScript@4.6: Can not match a node to this assertion.
ERROR: 334:1 expect TypeScript@4.6: Can not match a node to this assertion.
types/ws/index.d.ts
Outdated
| off(event: "connection", cb: (this: Server, socket: T, request: IncomingMessage) => void): this; | ||
| off(event: "error", cb: (this: Server, error: Error) => void): this; | ||
| off(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | ||
| off(event: "close" | "listening", cb: (this: Server) => void): this; | ||
| off(event: string | symbol, listener: (this: Server, ...args: any[]) => void): this; |
There was a problem hiding this comment.
| off(event: "connection", cb: (this: Server, socket: T, request: IncomingMessage) => void): this; | |
| off(event: "error", cb: (this: Server, error: Error) => void): this; | |
| off(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | |
| off(event: "close" | "listening", cb: (this: Server) => void): this; | |
| off(event: string | symbol, listener: (this: Server, ...args: any[]) => void): this; | |
| off(event: "connection", cb: (this: Server<T>, socket: T, request: IncomingMessage) => void): this; | |
| off(event: "error", cb: (this: Server<T>, error: Error) => void): this; | |
| off(event: "headers", cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void): this; | |
| off(event: "close" | "listening", cb: (this: Server<T>) => void): this; | |
| off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; |
types/ws/index.d.ts
Outdated
| once(event: "connection", cb: (this: Server, socket: T, request: IncomingMessage) => void): this; | ||
| once(event: "error", cb: (this: Server, error: Error) => void): this; | ||
| once(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | ||
| once(event: "close" | "listening", cb: (this: Server) => void): this; | ||
| once(event: string | symbol, listener: (...args: any[]) => void): this; |
There was a problem hiding this comment.
| once(event: "connection", cb: (this: Server, socket: T, request: IncomingMessage) => void): this; | |
| once(event: "error", cb: (this: Server, error: Error) => void): this; | |
| once(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | |
| once(event: "close" | "listening", cb: (this: Server) => void): this; | |
| once(event: string | symbol, listener: (...args: any[]) => void): this; | |
| once(event: "connection", cb: (this: Server<T>, socket: T, request: IncomingMessage) => void): this; | |
| once(event: "error", cb: (this: Server<T>, error: Error) => void): this; | |
| once(event: "headers", cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void): this; | |
| once(event: "close" | "listening", cb: (this: Server<T>) => void): this; | |
| once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; |
types/ws/index.d.ts
Outdated
| on(event: "error", cb: (this: Server, error: Error) => void): this; | ||
| on(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | ||
| on(event: "close" | "listening", cb: (this: Server) => void): this; | ||
| on(event: string | symbol, listener: (this: Server, ...args: any[]) => void): this; |
There was a problem hiding this comment.
| on(event: "error", cb: (this: Server, error: Error) => void): this; | |
| on(event: "headers", cb: (this: Server, headers: string[], request: IncomingMessage) => void): this; | |
| on(event: "close" | "listening", cb: (this: Server) => void): this; | |
| on(event: string | symbol, listener: (this: Server, ...args: any[]) => void): this; | |
| on(event: "error", cb: (this: Server<T>, error: Error) => void): this; | |
| on(event: "headers", cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void): this; | |
| on(event: "close" | "listening", cb: (this: Server<T>) => void): this; | |
| on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this; |
|
@vansergen, @jlalmes 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? |
|
@jlalmes 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? |
Co-authored-by: Sergey Bakulin <sergey.bakulin.github@gmail.com>
|
@mglyzin 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! |
|
@vansergen, @k-yle, @jakebailey, @jlalmes 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? |
|
@mglyzin 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! |
Co-authored-by: Sergey Bakulin <sergey.bakulin.github@gmail.com>
|
@vansergen, @k-yle, @jakebailey 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? |
|
@k-yle, @jakebailey 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? |
|
What's going on with this merge request? When it will be merged? |
|
I was waiting to see if you'd address @vansergen's outstanding comments, but they approved the PR so I'll do so as well. |
|
@mglyzin: Everything looks good here. I am ready to merge this PR (at cccf515) 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! ❤️ (@loyd, @mlamp, @TitaneBoy, @reduckted, @teidesu, @wojtkowiak, @k-yle, @cwadrupldijjit: you can do this too.) |
|
@k-yle 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? |
|
Very weird that the bot re-pinged when nothing changed and it had already pinged. Oh well... |
|
Ready to merge |
Ability to extend the original
WebSocketclassThis patch add type definitions for custom
WebSocketclass.This feature was merged in the original library at websockets/ws#2007
npm test <package to test>.