Skip to content

Array.prototype.flat limited depth to 21 #55685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PKrasinski opened this issue Sep 8, 2023 · 1 comment
Closed

Array.prototype.flat limited depth to 21 #55685

PKrasinski opened this issue Sep 8, 2023 · 1 comment

Comments

@PKrasinski
Copy link

⚙ 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

@MartinJohns
Copy link
Contributor

Anyone who has arrays with such a depth needs to take a very good look at itself in the mirror.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants