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/ws] Update ws definitions to v8.2 #55151

Merged
merged 10 commits into from Sep 25, 2021

Conversation

tamuratak
Copy link
Contributor

@tamuratak tamuratak commented Aug 15, 2021

Update ws definitions to v8.2:

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/websockets/ws/releases/tag/8.0.0
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.

- See https://github.com/websockets/ws/releases/tag/8.0.0
- Add the RawData type.
- Rename the OpenEvent class to Event.
@typescript-bot
Copy link
Contributor

typescript-bot commented Aug 15, 2021

@tamuratak Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because 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

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by a DT maintainer

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": 55151,
  "author": "tamuratak",
  "headCommitOid": "f23e37929bed30d39c125a9c508a46fe0e8bb6a7",
  "lastPushDate": "2021-09-25T10:23:07.000Z",
  "lastActivityDate": "2021-09-25T11:36:15.000Z",
  "mergeOfferDate": "2021-09-25T11:10:45.000Z",
  "mergeRequestDate": "2021-09-25T11:36:15.000Z",
  "mergeRequestUser": "tamuratak",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": 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"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "weswigham",
      "date": "2021-09-25T11:10:09.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "vansergen",
      "date": "2021-09-25T10:35:06.000Z",
      "isMaintainer": false
    },
    {
      "type": "stale",
      "reviewer": "lpinca",
      "date": "2021-09-24T18:10:00.000Z",
      "abbrOid": "add99dd"
    },
    {
      "type": "stale",
      "reviewer": "k-yle",
      "date": "2021-09-23T23:00:38.000Z",
      "abbrOid": "add99dd"
    },
    {
      "type": "stale",
      "reviewer": "onury",
      "date": "2021-08-29T15:24:16.000Z",
      "abbrOid": "14eefd0"
    },
    {
      "type": "stale",
      "reviewer": "rbuckton",
      "date": "2021-08-22T02:43:12.000Z",
      "abbrOid": "14eefd0"
    }
  ],
  "mainBotCommentID": 898979059,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @loyd @mlamp @TitaneBoy @reduckted @teidesu @wojtkowiak @k-yle — 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 typescript-bot added the The CI failed When GH Actions fails label Aug 15, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Aug 15, 2021
@typescript-bot
Copy link
Contributor

@tamuratak 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.

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Aug 15, 2021
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Aug 15, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Aug 15, 2021
@Pokute
Copy link

Pokute commented Aug 15, 2021

These are not correct TS definitions for ES Module.
The ES module has completely different exports, see https://github.com/websockets/ws/blob/78adf5f7737b10166c6f4903e6a5cdbbbb59934c/wrapper.mjs

@tamuratak
Copy link
Contributor Author

tamuratak commented Aug 15, 2021

When a CommonJS main file and an ES module main file have different exports, we don't have much we can do. The current PR can work with wrapper.mjs except for some cases.

@Pokute do you have any suggestions to improve?

@Pokute
Copy link

Pokute commented Aug 16, 2021

I couldn't access WebSocketServer through the definition file in this PR since the commonJS main file you linked with WebSocket.Server = require('./lib/websocket-server'); -line is not run when imported as an ES module. In the 8.0 version the WebSocket.WebServerSocket is not defined for ESM runtime version.

I did write a version of the definition, based on this version, that works for ES modules and also has typings for Receiver and Sender. I didn't test them at all though. Feel free to use it as you see fit if it helps.

I haven't done any contributions to DefinitelyTyped yet, so it would take some time to post a PR. I do not have any idea how to have different definition files for ESM and CJS, though.

@tamuratak
Copy link
Contributor Author

I didn't test them at all though. Feel free to use it as you see fit if it helps.

Thank you, but I won't use. I don't like to make breaking changes in this PR.

I do not have any idea how to have different definition files for ESM and CJS, though.

Since there is no way to improve this PR, I want to wait for the maintainers' review without changes.

@tamuratak
Copy link
Contributor Author

tamuratak commented Aug 16, 2021

The core committer of ws says

#55151 (comment) makes sense to me now that ws uses an ES module wrapper. It does not seem bad to me to cut a new major version of @types/ws that only works with ws@>=8. This is why semver versioning exists.

websockets/ws#1932 (comment)

types/ws/index.d.ts Show resolved Hide resolved
types/ws/index.d.ts Show resolved Hide resolved
types/ws/index.d.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@lpinca lpinca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is the same as https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55151/files#r690233908. The are already breaking changes so I think it is better to be more strict.

types/ws/index.d.ts Outdated Show resolved Hide resolved
types/ws/index.d.ts Outdated Show resolved Hide resolved
types/ws/index.d.ts Outdated Show resolved Hide resolved
types/ws/index.d.ts Outdated Show resolved Hide resolved
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Code Reviews in New Pull Request Status Board Aug 17, 2021
@typescript-bot
Copy link
Contributor

@lpinca 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?

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Aug 17, 2021
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Code Reviews in New Pull Request Status Board Aug 17, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Aug 17, 2021
@tamuratak

This comment has been minimized.

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Code Reviews in New Pull Request Status Board Aug 18, 2021
@weswigham
Copy link
Contributor

Omg the train of typos - export const WebSocket: WebSocketAlias;

@tamuratak
Copy link
Contributor Author

Omg the train of typos - export const WebSocket: WebSocketAlias;

It doesn't work.

スクリーンショット 2021-09-25 18 23 42

スクリーンショット 2021-09-25 18 24 22

@weswigham
Copy link
Contributor

🤦 typeof WebSocketAlias

@tamuratak
Copy link
Contributor Author

I see.

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Sep 25, 2021
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Sep 25, 2021
@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Sep 25, 2021
@typescript-bot
Copy link
Contributor

@tamuratak 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.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Sep 25, 2021
types/ws/index.d.ts Outdated Show resolved Hide resolved
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Sep 25, 2021
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Sep 25, 2021
@typescript-bot
Copy link
Contributor

@vansergen, @weswigham, @lpinca, @k-yle, @onury, @rbuckton 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?

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Sep 25, 2021
@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Sep 25, 2021
@typescript-bot
Copy link
Contributor

@weswigham, @lpinca, @k-yle, @onury, @rbuckton 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?

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Sep 25, 2021
@typescript-bot
Copy link
Contributor

@tamuratak: Everything looks good here. I am ready to merge this PR (at f23e379) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@loyd, @mlamp, @TitaneBoy, @reduckted, @teidesu, @wojtkowiak, @k-yle: you can do this too.)

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board Sep 25, 2021
@typescript-bot
Copy link
Contributor

@lpinca, @k-yle, @onury, @rbuckton 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?

@tamuratak
Copy link
Contributor Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board Sep 25, 2021
@typescript-bot typescript-bot merged commit b4c36ba into DefinitelyTyped:master Sep 25, 2021
@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Sep 25, 2021
@tamuratak tamuratak deleted the update_ws branch September 25, 2021 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical package Maintainer Approved Other Approved This PR was reviewed and signed-off by a community member. Self Merge This PR can now be self-merged by the PR author or an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet