Skip to content

feat: support BigUint64Array, BigInt64Array, and GenericArray#56163

Merged
typescript-bot merged 10 commits intoDefinitelyTyped:masterfrom
manzt:add-bigint
Oct 28, 2021
Merged

feat: support BigUint64Array, BigInt64Array, and GenericArray#56163
typescript-bot merged 10 commits intoDefinitelyTyped:masterfrom
manzt:add-bigint

Conversation

@manzt
Copy link
Copy Markdown
Contributor

@manzt manzt commented Oct 3, 2021

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

ndarray supports BigInt64 and BigUint64 data (see link above). This PR adds support for these typed arrays but preserves the default the top-level signature ndarray.Ndarray when the type parameters of Data aren't defined.

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Oct 3, 2021

@manzt Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

2 packages in this PR

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 which affect more than one package

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 56163,
  "author": "manzt",
  "headCommitOid": "878b2a71ecf88689abb04856adb75a420c864c96",
  "lastPushDate": "2021-10-20T14:19:32.000Z",
  "lastActivityDate": "2021-10-28T10:39:13.000Z",
  "mergeOfferDate": "2021-10-28T08:25:42.000Z",
  "mergeRequestDate": "2021-10-28T10:39:13.000Z",
  "mergeRequestUser": "manzt",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "ndarray",
      "kind": "edit",
      "files": [
        {
          "path": "types/ndarray/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/ndarray/ndarray-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "pawsong",
        "taoqf",
        "axelboc"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    },
    {
      "name": "numjs",
      "kind": "edit",
      "files": [
        {
          "path": "types/numjs/numjs-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "taoqf",
        "mattmm3d"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "orta",
      "date": "2021-10-28T08:25:06.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "axelboc",
      "date": "2021-10-21T13:09:03.000Z",
      "isMaintainer": false
    },
    {
      "type": "stale",
      "reviewer": "rbuckton",
      "date": "2021-10-19T22:11:51.000Z",
      "abbrOid": "5333643"
    }
  ],
  "mainBotCommentID": 933032741,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added the Check Config Changes a module config files label Oct 3, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Oct 3, 2021

🔔 @pawsong @taoqf @axelboc @mattmm3d — 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.

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Oct 3, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

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

@typescript-bot typescript-bot added The CI failed When GH Actions fails and removed The CI failed When GH Actions fails labels Oct 3, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

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

@typescript-bot typescript-bot added The CI failed When GH Actions fails and removed The CI failed When GH Actions fails Check Config Changes a module config files labels Oct 3, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

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

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Oct 3, 2021
Comment thread types/ndarray/index.d.ts Outdated
// Axel Bocciarelli <https://github.com/axelboc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference lib="esnext.bigint" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice, I was wondering how to make bigint work without impacting projects without esnext.bigint 💯

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the correct way to handle this. By adding a lib reference, you cause every compilation that depends on your package to assume that BigInt64Array is available. A lib reference should only be added for types provided from a host or runtime (such as NodeJS), or from a polyfill/shim library that adds the functionality.

If you want to depend on a "possibly available" BigInt64Array, you can do something like this instead:

type MaybeBigInt64Array = InstanceType<typeof globalThis extends { BigInt64Array: infer T } ? T : never>;
type MaybeBigUint64Array = InstanceType<typeof globalThis extends { BigUint64Array: infer T } ? T : never>;

This conditionally gets the type for BigInt64Array and BigUint64Array based on the user's settings. If they are not present, then the types are never (and are thus removed from unions), but if they are present you get the correct type.

Comment thread types/ndarray/index.d.ts Outdated
Comment thread types/ndarray/ndarray-tests.ts Outdated
@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Oct 4, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

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

@typescript-bot typescript-bot added Where is GH Actions? GH Actions didn't give a response to this PR and removed Revision needed This PR needs code changes before it can be merged. labels Oct 5, 2021
Comment thread types/ndarray/index.d.ts Outdated
@typescript-bot typescript-bot added Where is GH Actions? GH Actions didn't give a response to this PR and removed Where is GH Actions? GH Actions didn't give a response to this PR labels Oct 5, 2021
Copy link
Copy Markdown
Contributor

@axelboc axelboc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🚀

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Oct 5, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

@axelboc Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

Comment thread types/ndarray/index.d.ts Outdated
@typescript-bot
Copy link
Copy Markdown
Contributor

@axelboc Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Oct 7, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

Re-ping @pawsong, @taoqf, @mattmm3d:

This PR has been out for over a week, yet I haven't seen any reviews.

Could someone please give it some attention? Thanks!

@typescript-bot typescript-bot added the Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label Oct 18, 2021
Comment thread types/ndarray/index.d.ts Outdated
// Axel Bocciarelli <https://github.com/axelboc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference lib="esnext.bigint" />
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the correct way to handle this. By adding a lib reference, you cause every compilation that depends on your package to assume that BigInt64Array is available. A lib reference should only be added for types provided from a host or runtime (such as NodeJS), or from a polyfill/shim library that adds the functionality.

If you want to depend on a "possibly available" BigInt64Array, you can do something like this instead:

type MaybeBigInt64Array = InstanceType<typeof globalThis extends { BigInt64Array: infer T } ? T : never>;
type MaybeBigUint64Array = InstanceType<typeof globalThis extends { BigUint64Array: infer T } ? T : never>;

This conditionally gets the type for BigInt64Array and BigUint64Array based on the user's settings. If they are not present, then the types are never (and are thus removed from unions), but if they are present you get the correct type.

@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. and removed Owner Approved A listed owner of this package signed off on the pull request. Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels Oct 19, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

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

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Oct 20, 2021
@manzt
Copy link
Copy Markdown
Contributor Author

manzt commented Oct 20, 2021

@rbuckton -- thank you for the suggestion. I was not aware of the correct way to conditionally include these types. Fixed.

@typescript-bot
Copy link
Copy Markdown
Contributor

@rbuckton, @axelboc Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot
Copy link
Copy Markdown
Contributor

@rbuckton Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Oct 21, 2021
Copy link
Copy Markdown
Collaborator

@orta orta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, these changes look good now 👍🏻

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Oct 28, 2021
@typescript-bot
Copy link
Copy Markdown
Contributor

@manzt: Everything looks good here. I am ready to merge this PR (at 878b2a7) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

@manzt
Copy link
Copy Markdown
Contributor Author

manzt commented Oct 28, 2021

Ready to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Edits multiple packages Maintainer Approved Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants