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

fix: Return Value type of WebTorrent client.get() #69619

Closed
wants to merge 1 commit into from

Conversation

TechQuery
Copy link

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:

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.

@typescript-bot
Copy link
Contributor

typescript-bot commented May 15, 2024

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

1 package in this PR

Code Reviews

This PR can be merged once it's reviewed.

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 type definition owners or DT maintainers

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": 69619,
  "author": "TechQuery",
  "headCommitOid": "c6b4b7b7d1f4697c54284be70dd1087c1a1ac120",
  "mergeBaseOid": "bfdcd1c2bad2ed372ebf698103824f4171e5e972",
  "lastPushDate": "2024-05-15T18:07:31.000Z",
  "lastActivityDate": "2024-06-17T22:20:46.000Z",
  "maintainerBlessed": "Waiting for Code Reviews",
  "mergeOfferDate": "2024-06-17T19:22:11.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "webtorrent",
      "kind": "edit",
      "files": [
        {
          "path": "types/webtorrent/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "niieani",
        "tlaziuk",
        "gjuchault",
        "cheeseandcereal"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "gabritto",
      "date": "2024-06-17T19:21:34.000Z",
      "isMaintainer": true
    }
  ],
  "mainBotCommentID": 2113147370,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added the Untested Change This PR does not touch tests label May 15, 2024
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board May 15, 2024
@typescript-bot
Copy link
Contributor

🔔 @niieani @tlaziuk @gjuchault @cheeseandcereal — 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 moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board May 15, 2024
@TechQuery
Copy link
Author

I find that @types/webtorrent's version is at 0.109.x, which is an old version published at 4 years old: https://github.com/webtorrent/webtorrent/tree/v0.109.2

But the latest webtorrent is published at about 1 month ago: https://github.com/webtorrent/webtorrent/releases/tag/v2.2.1

When I use dts-gen to generate .d.ts, I failed with no ESM support:

$ dts-gen -m webtorrent
Unexpected crash! Please log a bug with the commandline you specified.
/home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js:84
        result = guess.generateModuleDeclarationFile(args.module, require(args.module));
                                                                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/webtorrent/index.js from /home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js not supported.
Instead change the require of index.js in /home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js:84:67) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.13.1

@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 26, 2024
@typescript-bot
Copy link
Contributor

Re-ping @niieani, @tlaziuk, @gjuchault, @cheeseandcereal:

This PR has been out for over a week, yet I haven't seen any reviews.

Could someone please give it some attention? Thanks!

@sheetalkamat sheetalkamat moved this from Needs Maintainer Review to Waiting for Code Reviews in New Pull Request Status Board May 28, 2024
@typescript-bot
Copy link
Contributor

It has been more than two weeks and this PR still has no reviews.

I'll bump it to the DT maintainer queue. Thank you for your patience, @TechQuery.

(Ping @niieani, @tlaziuk, @gjuchault, @cheeseandcereal.)

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Action in New Pull Request Status Board Jun 2, 2024
@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels Jun 17, 2024
@typescript-bot typescript-bot moved this from Needs Maintainer Action to Waiting for Author to Merge in New Pull Request Status Board Jun 17, 2024
@TechQuery
Copy link
Author

@gabritto This PR is not okay, it's not a detail bug.

This type package has been outdated for a long time from its upstream, so we need to regenerate the whole type definition from the latest source code.

But I blocked by the issue shown above, I need help.

@gabritto
Copy link
Contributor

I find that @types/webtorrent's version is at 0.109.x, which is an old version published at 4 years old: https://github.com/webtorrent/webtorrent/tree/v0.109.2

But the latest webtorrent is published at about 1 month ago: https://github.com/webtorrent/webtorrent/releases/tag/v2.2.1

When I use dts-gen to generate .d.ts, I failed with no ESM support:

$ dts-gen -m webtorrent
Unexpected crash! Please log a bug with the commandline you specified.
/home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js:84
        result = guess.generateModuleDeclarationFile(args.module, require(args.module));
                                                                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/webtorrent/index.js from /home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js not supported.
Instead change the require of index.js in /home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/gitpod/.pnpm/global/5/.pnpm/[email protected]/node_modules/dts-gen/dist/run.js:84:67) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.13.1

Unfortunately dts-gen does not support ESM, like you said, and we currently don't have plans to update dts-gen to support it. So if you want to update the type definitions for this package, I could only suggest doing it manually.

@gabritto
Copy link
Contributor

Closing this as per #69619 (comment).

@gabritto gabritto closed this Jun 17, 2024
@typescript-bot typescript-bot removed this from Waiting for Author to Merge in New Pull Request Status Board Jun 17, 2024
@TechQuery TechQuery deleted the patch-1 branch June 17, 2024 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner Untested Change This PR does not touch tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants