Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yashsavalia1
Copy link

Correct incorrect typing for websocket in express-ws types

Please fill in this template.

Select one of these and delete the others:

If adding a new definition:

  • The package does not already provide its own types, or cannot have its .d.ts files generated via --declaration
  • If this is for an npm package, match the name. If not, do not conflict with the name of an npm package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • Represents shape of module/library correctly
  • tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: <>
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the package.json.

If removing a declaration:

  • If a package was never on Definitely Typed, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.)
  • Delete the package's directory.
  • Add it to notNeededPackages.json.

Minor type fix
@typescript-bot typescript-bot added this to Needs Author Action in New Pull Request Status Board May 4, 2024
@yashsavalia1 yashsavalia1 changed the title Correct incorrect typing for websocket in express-ws types [@types/express-ws] Correct incorrect typing for websocket in express-ws types May 4, 2024
@yashsavalia1 yashsavalia1 marked this pull request as ready for review May 4, 2024 20:53
@typescript-bot
Copy link
Contributor

typescript-bot commented May 4, 2024

@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 PR

Code Reviews

This PR can be merged once it's reviewed by a DT maintainer.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Only a DT maintainer can approve changes without tests

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"
}

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Untested Change This PR does not touch tests labels May 4, 2024
@typescript-bot typescript-bot moved this from Needs Author Action to Needs Maintainer Review in New Pull Request Status Board May 4, 2024
@typescript-bot
Copy link
Contributor

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!

@typescript-bot
Copy link
Contributor

🔔 @ajliv — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot
Copy link
Contributor

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!

@typescript-bot typescript-bot added the Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label May 15, 2024
}

type WebsocketRequestHandler = (ws: ws, req: express.Request, next: express.NextFunction) => void;
type WebsocketRequestHandler = (ws: ws.WebSocket, req: express.Request, next: express.NextFunction) => void;
Copy link
Contributor

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;
Copy link
Contributor

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.

@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels May 16, 2024
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in New Pull Request Status Board May 16, 2024
@typescript-bot
Copy link
Contributor

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Popular package This PR affects a popular package (as counted by NPM download counts). Revision needed This PR needs code changes before it can be merged. Untested Change This PR does not touch tests
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants