• Blog
  • Changelog
  • Follow us on GitHubFollow us on XJoin our Discord server
  • Blog
  • GitHub
  • Releases
  • Getting started

    • Overview
  • Library

    • Getting started
    • Result
    • Task
    • Type
    • Dependency injection
    • Conventions
  • Local-first

    • Getting started
    • Playgrounds
    • Examples
    • Owners
    • Relay
    • Migrations
    • Time travel
    • Indexes
    • Protocol
    • Privacy
    • FAQ
  • Other

    • API reference
    • Comparison
    • Showcase
    • Changelog

API reference / @evolu/common / Array / popArray

Function: popArray()

function popArray<T>(array): T;

Defined in: packages/common/src/Array.ts:433

Pops an item from a non-empty mutable array, guaranteed to return T.

Mutates the original array.

Example

const arr: NonEmptyArray<number> = [1, 2, 3];
popArray(arr); // 3
arr; // [1, 2]

Type Parameters

Type Parameter
T

Parameters

ParameterType
array[T, ...T[]]

Returns

T

Was this page helpful?

© Copyright 2025. All rights reserved.

Follow us on GitHubFollow us on XJoin our Discord server