Skip to content

Array.splice "deleteCount" argument description is somewhat insufficient #61081

Open
@birgersp

Description

@birgersp

⚙ Compilation target

ES2022

⚙ Library

lib.es5.d.ts (?)

Missing / Incorrect Definition

Array.splice

Sample Code

[1, 2, 3].splice(0, undefined) // what, exactly, should this return?

Documentation Link

I found myself using Array.splice but I wanted to erase from and index and the rest of the array.

Apparently, if I omit the "deleteCount" argument, the "rest of the array" is deleted.

(This is documented here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice#deletecount)

In my opinion, this should have been described in the library typings/JSDOC.

Image

This documentation should include a proper description of the "deleteCount" argument.

E.g. the docus should say something along the lines of:

@param - deleteCount The number of elements to remove. Omit this argument to remove all elements from index to the end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions