Skip to content

TypeScript · maintainability

no-positional-tuple-return

eslint:no-positional-tuple-return

Disallow returning a multi-field tuple from an exported function; return a named object so call sites cannot mismatch slots.

Default
error
Fix
none
Languages
typescript

Why

Public tuple fields are identified only by position, so reordering can preserve types while changing meaning.

Fix

Return an object whose property names describe each value.

Before / after

Executed by this rule’s unit tests.

Before

Do not expose positional fields

src/download.ts · focus
export function download(): [string, number] { return impl(); }

After

Return named fields

src/download.ts · focus
export function download(): { body: string; status: number } { return impl(); }

Limits

  • Only declared multi-field tuple returns on public TypeScript surfaces are inspected.

Message IDs

noPositionalTupleReturn