Skip to content

Array.prototype.flat limited depth to 21 #55685

@PKrasinski

Description

@PKrasinski

⚙ Compilation target

ES2019

⚙ Library

es2019

Missing / Incorrect Definition

Array.prototype.flat definition is supporting depth only up to 21. Over 21 return wrong type.

Sample Code

const foo = [ [ ['string' ] ] ]
const flatFoo = foo.flat(22) // string[][][] should be string[]

Documentation Link

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions