persona-community-5/.pnpm-store/v3/files/92/9711535af82722a1100b9cec0b803ea4015057c264fb131db00b37307355cd6350d851ed355138ed57e8780d3ada0bb184a98513c73c1e9f23388a6d3af55a
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

36 lines
757 B
Plaintext

---
description: 'Disallow generic `Array` constructors.'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
> 🛑 This file is source code, not the primary documentation location! 🛑
>
> See **https://typescript-eslint.io/rules/no-array-constructor** for documentation.
This rule extends the base [`eslint/no-array-constructor`](https://eslint.org/docs/rules/no-array-constructor) rule.
It adds support for the generically typed `Array` constructor (`new Array<Foo>()`).
<Tabs>
<TabItem value="❌ Incorrect">
```ts
Array(0, 1, 2);
new Array(0, 1, 2);
```
</TabItem>
<TabItem value="✅ Correct">
```ts
Array<number>(0, 1, 2);
new Array<Foo>(x, y, z);
Array(500);
new Array(someOtherArray.length);
```
</TabItem>
</Tabs>