Skip to content

[node] Add new v8 feature: relative indexing method#55061

Closed
Semigradsky wants to merge 1 commit intoDefinitelyTyped:masterfrom
Semigradsky:nodejs
Closed

[node] Add new v8 feature: relative indexing method#55061
Semigradsky wants to merge 1 commit intoDefinitelyTyped:masterfrom
Semigradsky:nodejs

Conversation

@Semigradsky
Copy link
Contributor

16.6.0 released

https://github.com/nodejs/node/releases/tag/v16.6.0

  • v8: introduces the new Array.prototype.at method (also on Typed Arrays and strings)

Please fill in this template.

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: <>
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.

https://github.com/nodejs/node/releases/tag/v16.6.0

- v8: introduces the new `Array.prototype.at` method
@typescript-bot
Copy link
Contributor

typescript-bot commented Aug 10, 2021

@Semigradsky Thank you for submitting this PR!

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because 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

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Most recent commit is approved by a DT maintainer

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": 55061,
  "author": "Semigradsky",
  "headCommitOid": "8ce5a3e2159f7f6b9483b269345cd134773a2b59",
  "lastPushDate": "2021-08-10T18:09:23.000Z",
  "lastActivityDate": "2021-08-11T21:40:40.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "node",
      "kind": "edit",
      "files": [
        {
          "path": "types/node/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/test/globals.ts",
          "kind": "test"
        },
        {
          "path": "types/node/ts3.6/base.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",
        "NodeJS",
        "LinusU"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "changereq",
      "reviewer": "amcasey",
      "date": "2021-08-10T21:35:14.000Z"
    }
  ],
  "mainBotCommentID": 896206568,
  "ciResult": "pass"
}

@SimonSchick
Copy link
Contributor

I'm not sure we can add a dependency like this to @types/node.
I added partial support for this in #55057 (only strings, array, Uint8Array), we should probably augment the node typings instead?

Copy link
Contributor

@amcasey amcasey left a comment

Choose a reason for hiding this comment

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

Please work with @SimonSchick to find an appropriate approach.

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Aug 10, 2021
@typescript-bot
Copy link
Contributor

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

@Semigradsky
Copy link
Contributor Author

@SimonSchick so will you add full support TypedArray#at to your PR? In this case this PR can be closed.
I just thought that adding esnext typings to separate package can improve readability and make changing Node.js typings slightly easy.

@yoursunny
Copy link
Contributor

I wonder why TypedArray#at should be in DefinitelyTyped?
It's part of the JavaScript language, which is usually added to TypeScript itself as a target.

@Semigradsky
Copy link
Contributor Author

@yoursunny TypedArray#at as Array#at or String#at will be added to lib.d.ts in some day (microsoft/TypeScript#40695). But what about users which can't use the last TypeScript for any reason?

@SimonSchick
Copy link
Contributor

@yoursunny DT needs to still support TS 3.6 (soon 3.7), we sadly can't always rely on bleeding edge libs be available.

@yoursunny
Copy link
Contributor

Users who need TypedArray#at on older TS can manually import @types/proposal-relative-indexing-method.
There's no need to include it in @types/node.

@SimonSchick
Copy link
Contributor

@yoursunny this seems pretty inconvenient to users, how do we explain to them that, in order to use modern JS features on an older TS version, they must to install some 'proposal-' package?

I think for convenience and simplicities sake the typings should be shipped in node.

@yoursunny
Copy link
Contributor

how do we explain to them that, in order to use modern JS features on an older TS version, they must to install some 'proposal-' package?

The recommended method shall be setting an appropriate target, using a TypeScript version that supports said target.
Installing proposal- package is merely a workaround.

@SimonSchick
Copy link
Contributor

SimonSchick commented Aug 11, 2021

Landed in node via #55057

@Semigradsky Semigradsky deleted the nodejs branch August 12, 2021 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Revision needed This PR needs code changes before it can be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants