Skip to main content

Disallow generic Array constructors (no-array-constructor)

Rule Details

This rule extends the base eslint/no-array-constructor rule. It adds support for the generically typed Array constructor (new Array<Foo>()).

/*eslint no-array-constructor: "error"*/

Array(0, 1, 2);
new Array(0, 1, 2);

How to Use

// note you must disable the base rule as it can report incorrect errors
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": ["error"]


See eslint/no-array-constructor options.

Taken with โค๏ธ from ESLint core


  • โœ… Recommended
  • ๐Ÿ”ง Fixable
  • ๐Ÿ’ญ Requires type information