Skip to content

Variable: EMPTY_ARR

const EMPTY_ARR: readonly never[]

An empty array that is frozen in development mode for immutability. Use this constant instead of creating new empty arrays to improve performance.

Example

typescript
// Good
const items = someCondition ? userItems : EMPTY_ARR

// Instead of
const items = someCondition ? userItems : []

Released under the MIT License.