fix: drop incorrect types for webtorrent org packages
Please fill in this template.
- [x] Use a meaningful title for the pull request. Include the name of the package modified.
- [x] Test the change in your own code. (Compile and run.)
- [ ] Add or edit tests to reflect the change.
- [ ] Follow the advice from the readme.
- [ ] Avoid common mistakes.
- [ ] Run
pnpm test <package to test>.
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.tsfiles 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.jsonshould havenoImplicitAny,noImplicitThis,strictNullChecks, andstrictFunctionTypesset totrue.
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.)
- [x] Delete the package's directory.
- [x] Add it to
notNeededPackages.json.
These types for webtorrent's packages have been outdated for ages, and for the most part aren't needed because we use JSDoc where it's important.
These types are causing an insane amt of issues for us, both for development, and for maintaining, since VSCode incorrectly inherits DT's types, and people keep making issues complaining that a function works incorrectly, because these types are wrong and are telling them incorrect things.
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69947
@ThaUnknown Thank you for submitting this PR!
This is a live comment that I will keep updated.
This PR touches some part of DefinitelyTyped infrastructure, so a DT maintainer will need to review it. This is rare — did you mean to do this?
4 packages in this PR (and infra files)
bittorrent-protocol(probably deleted!) — on npm, on unpkg- Config files to check:
create-torrent(probably deleted!) — on npm, on unpkgparse-torrent(probably deleted!) — on npm, on unpkgwebtorrent(probably deleted!) — on npm, on unpkg- Infra files
Code Reviews
Because this PR edits multiple packages, it 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
- 🕐 A DT maintainer needs to approve changes that affect DT infrastructure (
notNeededPackages.json)
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.
Inactive
This PR has been inactive for 31 days — it is considered abandoned, and therefore closed!
Diagnostic Information: What the bot saw about this PR
{
"type": "info",
"now": "-",
"pr_number": 70064,
"author": "ThaUnknown",
"headCommitOid": "138483507c2f200b2d849c6a5fdfd767a79c6f2c",
"mergeBaseOid": "b4ae44884a5a4a56d6059d81f1567d3f6983dbe8",
"lastPushDate": "2024-07-16T08:30:58.000Z",
"lastActivityDate": "2024-11-20T03:44:11.000Z",
"hasMergeConflict": true,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"popularityLevel": "Well-liked by everyone",
"pkgInfo": [
{
"name": null,
"kind": "edit",
"files": [
{
"path": "notNeededPackages.json",
"kind": "infrastructure"
}
],
"owners": [],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical",
"isSafeInfrastructureEdit": false
},
{
"name": "bittorrent-protocol",
"kind": "delete",
"files": [
{
"path": "types/bittorrent-protocol/.eslintrc.json",
"kind": "package-meta",
"suspect": "edited"
},
{
"path": "types/bittorrent-protocol/.npmignore",
"kind": "package-meta-ok"
},
{
"path": "types/bittorrent-protocol/bittorrent-protocol-tests.ts",
"kind": "test"
},
{
"path": "types/bittorrent-protocol/index.d.ts",
"kind": "definition"
},
{
"path": "types/bittorrent-protocol/package.json",
"kind": "package-meta-ok"
},
{
"path": "types/bittorrent-protocol/tsconfig.json",
"kind": "package-meta-ok"
}
],
"owners": [
"feross",
"tlaziuk",
"h1b9b"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
},
{
"name": "create-torrent",
"kind": "delete",
"files": [
{
"path": "types/create-torrent/.npmignore",
"kind": "package-meta-ok"
},
{
"path": "types/create-torrent/create-torrent-tests.ts",
"kind": "test"
},
{
"path": "types/create-torrent/index.d.ts",
"kind": "definition"
},
{
"path": "types/create-torrent/package.json",
"kind": "package-meta-ok"
},
{
"path": "types/create-torrent/tsconfig.json",
"kind": "package-meta-ok"
}
],
"owners": [
"jesec"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
},
{
"name": "parse-torrent",
"kind": "delete",
"files": [
{
"path": "types/parse-torrent/.npmignore",
"kind": "package-meta-ok"
},
{
"path": "types/parse-torrent/index.d.ts",
"kind": "definition"
},
{
"path": "types/parse-torrent/package.json",
"kind": "package-meta-ok"
},
{
"path": "types/parse-torrent/parse-torrent-tests.ts",
"kind": "test"
},
{
"path": "types/parse-torrent/tsconfig.json",
"kind": "package-meta-ok"
}
],
"owners": [
"niieani",
"tlaziuk"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
},
{
"name": "webtorrent",
"kind": "delete",
"files": [
{
"path": "types/webtorrent/.npmignore",
"kind": "package-meta-ok"
},
{
"path": "types/webtorrent/index.d.ts",
"kind": "definition"
},
{
"path": "types/webtorrent/package.json",
"kind": "package-meta-ok"
},
{
"path": "types/webtorrent/tsconfig.json",
"kind": "package-meta-ok"
},
{
"path": "types/webtorrent/webtorrent-tests.ts",
"kind": "test"
}
],
"owners": [
"niieani",
"tlaziuk",
"gjuchault",
"cheeseandcereal"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Well-liked by everyone"
}
],
"reviews": [
{
"type": "changereq",
"reviewer": "jesec",
"date": "2024-10-20T08:55:04.000Z"
},
{
"type": "changereq",
"reviewer": "jakebailey",
"date": "2024-07-16T16:02:48.000Z"
}
],
"mainBotCommentID": 2230325063,
"ciResult": "pass"
}
🔔 @feross @tlaziuk @h1b9b @jesec @niieani @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.
@ThaUnknown 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!
@jakebailey what is the correct way of proceeding then, that doesn't require me to waste weeks of my free time?
- making DT types accurate is unrealistic because of the sheer amt of work it requires
- overriding these invalid types in our package with
anybreaks type inference and intellisense - generating from JSDoc leads to similarly incorrect types as
tscisn't omnipotent and can't detect dynamic key access and probably other things
I'd preferably want to not have types from DT apply after specific versions:
since thats roughly where the old types are still accurate enough, and simply let the already defined jsdoc in the package and type inference take over, but I don't know if typescript even allows that
@ThaUnknown I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Aug 15th (in a week) if the issues aren't addressed.
bump
@ThaUnknown I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Sep 7th (in a week) if the issues aren't addressed.
bump
@ThaUnknown I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Oct 1st (in a week) if the issues aren't addressed.
bump
@ThaUnknown I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Oct 24th (in a week) if the issues aren't addressed.
bump
lord this is by far the most annoying repository i've ever experienced, package provides jsdoc where it's applicable, and all these people whining that there are no types, aren't fixing the types, WHICH ARE COMPLETLY INCORRECT, I do NOT understand how some1 can merge broken and incorrect types, and then the repository maintainers can't remove them, even tho they are malicious, anyways since i'm the package maintainer so since this repo is so against me being able to remove the incorrect types, i'll just force resolve it to any
also @jesec those comments were replied to, so idk what you're saying
I'm really not sure what to do here at this point. It's just a fact that for TypeScript users to use a library, that library needs .d.ts files. They have to live here or in your packages.
You don't seem to want to maintain types in your packages, so for TS users to use your packages, the types must be here. But you don't want the types that are here because they're out of date. Deleting them will break all TS users, but sort of improve things for JS users because tsserver does a limited analysis of JS code in node_modules for untyped libraries.
"Removing" can only be one of two things:
- Delete the packages from DT, let the old ones live on npm as-is. You don't want this option because you don't like the types that are here.
- Mark the packages as
notNeeded. This basically means DT will never hold types for these packages again, and the only way any TS user will ever be able to use your library again will be for you to update your package.
There are no other options. Packages cannot be unpublished.
Which one of these is the right option?
Maybe the solution really is just for DT to wipe our hands of these packages and you just declare everything as any over in your repo. I don't like this option because it removes any ability for third parties to improve things, but it is your package.
I see you sent https://github.com/webtorrent/webtorrent/pull/2876, if this is the direction you want to take, then that's totally up to you. You can just do this to all of your packages, publish them with a d.ts files, and we'll merge this PR with updated version numbers.
yes, that PR was created because DT tied my hands, it wouldn't exist if I could simply control the types over the packages I maintain, the fact that package maintainers don't have permissions to their own types is a bit wild to me
to me marking the packages as not needed is the best way to do it, but DT clearly doesn't agree until I have my own types, which is why that PR exists, I'd rather not merge it, because it then also breaks JS on top of breaking TS, which is even worse, but its better than having completely incorrect and absurd types
it wouldn't exist if I could simply control the types over the packages I maintain, the fact that package maintainers don't have permissions to their own types is a bit wild to me
What you you mean? You can totally be an owner on the DT packages and send PRs to DT.
it wouldn't exist if I could simply control the types over the packages I maintain, the fact that package maintainers don't have permissions to their own types is a bit wild to me
What you you mean? You can totally be an owner on the DT packages and send PRs to DT.
clearly not, because I cannot remove these incorrect types, instead i need to jump 14 hoops, while being spammed by issues of "hey this function isnt working according to the outdated type documentation"
Removing the types and breaking all TS users is a totally different scenario to just updating the types so that they're correct. Adding/removing packages from DT is something that has to be monitored.
There are a non-zero number of packages which are on DT and have types updated by their maintainers or community members; if you sent a PR that updated the types here, it would absolutely be reviewed and accepted.
DT is supposed to be wikipedia for types, but even wikipedia doesn't just let anyone delete pages.
yes, but wikipedia moderates incorrect entries, this doesnt, maybe by breaking it for users which auto-update all packages instead of locking versions, some1 will spent the month or so of their life creating these types
The options here are:
- You put
.d.tsfiles (of any quality, I don't care!) into your packages making them typed, we merge this PR after those are published so your packages are pointed to in the deprecated shims in@typeson npm. Your users (TS and JS users both) file issues about the quality / accuracy of your types to your repo and you fix them (or don't). - You update the types here to be accurate. TS and JS users are happy.
- You don't personally update the types here, but point anyone on your repo to the DT repo to make contributions to fix this, and close their issues as not your problem.
Which of these do you want to do to resolve the problem?
I do not see any other option. We simply cannot merge this PR as-is without other d.ts files present as that will make your packages unimportable in any TypeScript file.
@ThaUnknown Unfortunately, this pull request currently has a merge conflict 😥. Please update your PR branch to be up-to-date with respect to master. Have a nice day!
@ThaUnknown I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Nov 20th (in a week) if the issues aren't addressed.
I'll re-up this one more time; I'm really wanting to get this handled, but we really need to know which of the previously noted options will work best.
@ThaUnknown I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Dec 20th (in a week) if the issues aren't addressed.
@ThaUnknown To keep things tidy, we have to close PRs that aren't mergeable and don't have activity in the last month. No worries, though — please open a new PR if you'd like to continue with this change. Thank you!