GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — [node] make crypto.randomFill[Sync] return type equal to first arg type by kjin · Pull Request #26886 · DefinitelyTyped/DefinitelyTyped Conversation
|
| export function randomFill(buffer: ArrayBufferView, callback: (err: Error | null, buf: ArrayBufferView) => void): void; | ||
| export function randomFill(buffer: ArrayBufferView, offset: number, callback: (err: Error | null, buf: ArrayBufferView) => void): void; | ||
| export function randomFill(buffer: ArrayBufferView, offset: number, size: number, callback: (err: Error | null, buf: ArrayBufferView) => void): void; | ||
| export function randomFillSync<T extends Buffer|ArrayBufferView>(buffer: T, offset?: number, size?: number): T; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
style note: can you add spaces around | for consistency with other code.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think that Buffer| is needed at all as ArrayBufferView includes Buffer - if not the definition of quite some APIs in crypto would be wrong.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@kjin Thank you for submitting this PR! 🔔 @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @BrunoScheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@kjin The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Should just add realistically. I get that this was technically caused by my change but just add a signature rather than changing the signature entirely. Also because of how ArrayBufferView is defined it's fine with Buffer so there's no need for it specifically. Realistically you could revert then add those where appropriate. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ZaneHannanAU @Flarna interface ArrayBufferView { /** * The ArrayBuffer instance referenced by the array. */ buffer: ArrayBufferLike; /** * The length in bytes of the array. */ byteLength: number; /** * The offset in bytes of the array. */ byteOffset: number; } |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2a79716 to
feadd37
Compare
|
I'm a little bit confused here. I expected |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@kjin quite completely mistaken. ArrayBufferView is just an interface. Anything implementing those three (buffer, byteOffset, byteLength) as those types (ArrayBuffer/ArrayBufferLike, number, number) is taken as such. … basically yeah ArrayBufferView is fine with anything implementing those three specifically. Buffer, Uint8Array, Uint32Array, DataView, BigInt64Array, Float64Array etc. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
In crypto APIs no duck typing is used. If you pass an object fitting the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
... realistically if it passes the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm guessing it's because they must be readonly? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I agree with @Flarna for replace |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think we should do the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.