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] introduce TypedArray by Flarna · Pull Request #27387 · DefinitelyTyped/DefinitelyTyped Conversation
Contributor
Add a union type for @kjin @ikokostya @ZaneHannanAU This is a followup on our discussion in #26886. Would be nice if you can take a look or even try it in your code.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
@Flarna Thank you for submitting this PR! 🔔 @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @BrunoScheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @ZaneHannanAU - 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.
|
@Flarna 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.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The replacements look good. @ZaneHannanAU @ikokostya seem to have more context on the reasoning behind this change, though.
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.
Will Ned to update later for BigInt64Array and BigUint64Array inclusion; but that's a few moments of effort by comparison.
Once TS ships BigInt/bigint support that's all.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| constructor(id: string, parent?: Module); | ||
| } | ||
|
|
||
| type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why need to introduce new type definition instead of using ArrayBufferView, which covers the same types https://heycam.github.io/webidl/#common ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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.
Hmm. Maybe something wrong, but in MDN docs ArrayBufferView also contains DataView
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.
From MDN docs point of view it looks nice but the definiton in lib.es5.d.ts is quite reduced compared to that:
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;
}
See also #26886 (comment) and #26886 (comment)
To my knowlege Node really checks on types in this so I think using a union of existing types matches better then the loose ArrayBufferView interface.
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.
Yeah. The actual one checks against the string name of the prototype rather than eg ArrayBuffer.isView().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Flarna I haven't seen anything from you in a while and this PR currently has problems that prevent it from being merged. The PR will be closed tomorrow if there aren't new commits to fix the issues. |
Sorry, something went wrong.
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.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.