-
Notifications
You must be signed in to change notification settings - Fork 30.5k
node: Make Buffer mergeable #54479
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
node: Make Buffer mergeable #54479
Conversation
This allows packages that may or may not depend on node create a Buffer stub. This will solve the current problem with dependents of `@types/mongoose`, which is deprecated but also broken on `@types/node@16` because of the way it references `global.Buffer`.
|
@sandersn Thank you for submitting this PR! This is a live comment which I will keep updated. 2 packages 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
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": 54479,
"author": "sandersn",
"headCommitOid": "345beb76f3d61f7542c2560a4cdaad2902bc8460",
"lastPushDate": "2021-07-13T22:26:43.000Z",
"lastActivityDate": "2021-07-13T22:35:56.000Z",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "node",
"kind": "edit",
"files": [
{
"path": "types/node/buffer.d.ts",
"kind": "definition"
}
],
"owners": [
"Microsoft",
"DefinitelyTyped",
"jkomyno",
"alvis",
"r3nya",
"btoueg",
"smac89",
"touffy",
"DeividasBakanas",
"eyqs",
"Hannes-Magnusson-CK",
"KSXGitHub",
"hoo29",
"kjin",
"ajafff",
"islishude",
"mwiktorczyk",
"mohsen1",
"n-e",
"galkin",
"parambirs",
"eps1lon",
"SimonSchick",
"ThomasdenH",
"WilcoBakker",
"wwwy3y3",
"samuela",
"kuehlein",
"bhongy",
"chyzwar",
"trivikr",
"nguymin4",
"yoursunny",
"qwelias",
"ExE-Boss",
"Ryan-Willpower",
"peterblazejewicz",
"addaleax",
"JasonHK",
"victorperin",
"ZYSzys"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
},
{
"name": "safer-buffer",
"kind": "edit",
"files": [
{
"path": "types/safer-buffer/safer-buffer-tests.ts",
"kind": "test"
}
],
"owners": [
"ffflorian"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Popular"
}
],
"reviews": [],
"mainBotCommentID": 878699083,
"ciResult": "fail",
"ciUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/commit/345beb76f3d61f7542c2560a4cdaad2902bc8460/checks?check_suite_id=3231602075"
} |
|
🔔 @microsoft @DefinitelyTyped @jkomyno @alvis @r3nya @btoueg @smac89 @Touffy @DeividasBakanas @eyqs @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @mohsen1 @n-e @galkin @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @samuela @kuehlein @bhongy @chyzwar @trivikr @nguymin4 @yoursunny @qwelias @ExE-Boss @Ryan-Willpower @peterblazejewicz @addaleax @JasonHK @victorperin @ZYSzys @ffflorian — please review this PR in the next few days. Be sure to explicitly select |
|
@sandersn 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. |
|
@sandersn any timeline for classes to be mergeable with other class declarations? |
|
I assume this will fix issues seen in the CI complaining about Buffer. I've seen this today on other failing PR not related to |
1. The name of the static side of Buffer is now BufferConstructor. 2. BYTES_PER_LENGTH is no longer a static member of Buffer.
|
@SimonSchick It's not something we've considered recently because it's possible today and not a common requirement.
@peterblazejewicz It should fix all the dependents of the deprecated |
|
@sandersn 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. |
|
@peterblazejewicz After some experimentation, I'm going to ship this as-is, so that it only fixes mongoose dependents. safer-buffer, for example, still fails with Because resolution of 'buffer' resolves not to the ambient module in DT/types/node/buffer.d.ts but the actual module in DT/node_modules/buffer/index.d.ts. It's likely that this will necessitate some other fix to buffer, but I want to at least get the mongoose dependents up and running again. |
|
I just published |
This allows packages that may or may not depend on node create a Buffer stub.
This will solve the current problem with dependents of
@types/mongoose, which is deprecated but also broken on@types/node@16because of the way it referencesglobal.Buffer. Even disregarding mongoose, a central class likeBuffershould be declared in a mergeable way so that other packages can add to it in extenuating circumstances.