GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [node] introduce TypedArray by Flarna · Pull Request #27387 · DefinitelyTyped/DefinitelyTyped

Conversation

@Flarna

@Flarna Flarna commented Jul 18, 2018

Copy link
Copy Markdown
Contributor
  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).
  • Provide a URL to documentation or source code which provides context for the suggested changes:
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
    https://nodejs.org/dist/latest/docs/api/crypto.html
    https://nodejs.org/dist/latest/docs/api/http2.html
    https://nodejs.org/dist/latest/docs/api/zlib.html
  • Increase the version number in the header if appropriate.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }.

Add a union type for TypedArray and use it at all places found in NodeJs doc.

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

islishude and ZaneHannanAU reacted with thumbs up emoji ZaneHannanAU reacted with hooray emoji
All reactions
  • 👍 2 reactions
  • 🎉 1 reaction
@Flarna

Flarna commented Jul 18, 2018

Copy link
Copy Markdown
Contributor Author

CI fail should be fixed by #27212

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). Author is Owner The author of this PR is a listed owner of the package. labels Jul 18, 2018
@typescript-bot

typescript-bot commented Jul 18, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@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 Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot typescript-bot added the The Travis CI build failed label Jul 18, 2018
@typescript-bot

typescript-bot commented Jul 18, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kjin
kjin approved these changes Jul 19, 2018
View reviewed changes

@kjin kjin left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Jul 19, 2018
ZaneHannanAU
ZaneHannanAU approved these changes Jul 20, 2018
View reviewed changes

@ZaneHannanAU ZaneHannanAU left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ikokostya
ikokostya reviewed Jul 20, 2018
View reviewed changes
Comment thread types/node/index.d.ts
constructor(id: string, parent?: Module);
}

type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;

@ikokostya ikokostya Jul 20, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ikokostya ikokostya Jul 20, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

ZaneHannanAU reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@Flarna Flarna Jul 21, 2018

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ZaneHannanAU ZaneHannanAU Jul 21, 2018

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Flarna Flarna closed this Jul 23, 2018
@Flarna Flarna reopened this Jul 23, 2018
@typescript-bot

typescript-bot commented Jul 23, 2018

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Flarna
[node] introduce TypedArray
40e8985
@typescript-bot typescript-bot added Merge:Express and removed The Travis CI build failed labels Jul 24, 2018
@typescript-bot

typescript-bot commented Jul 24, 2018

Copy link
Copy Markdown
Contributor

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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ghost
ghost merged commit 2bb44da into DefinitelyTyped:master Jul 24, 2018
@Flarna
Flarna deleted the node-typed-array branch July 24, 2018 17:46
briandk pushed a commit to briandk/DefinitelyTyped that referenced this pull request Aug 7, 2018
@Flarna @briandk
[node] introduce TypedArray (DefinitelyTyped#27387)
a5bf827
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

3 more reviewers
@ikokostya ikokostya ikokostya left review comments
@ZaneHannanAU ZaneHannanAU ZaneHannanAU approved these changes
@kjin kjin kjin approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Author is Owner The author of this PR is a listed owner of the package. Owner Approved A listed owner of this package signed off on the pull request. Popular package This PR affects a popular package (as counted by NPM download counts).

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@Flarna @typescript-bot @ikokostya @kjin @ZaneHannanAU
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.