Skip to content

Concat

Overview

Type Concat

Concatenating tuple types, see https://stackoverflow.com/questions/64630803/concat-tuple-types-in-typescript

For instance, Concat<[A, B], [C, D]> is equivalent to [A, B, C, D]. This can also flatten an array with Concat<...types>.

@author Jonathan Olson <jonathan.olson@colorado.edu>

import type { Concat } from 'scenerystack/phet-core';

T extends [ infer A, ...infer Rest ] ? A extends IntentionalAny[] ? [ ...A, ...( Concat<Rest> extends IntentionalAny[] ? Concat<Rest> : [] ) ] : A : T

Source Code

See the source for Concat.ts in the phet-core repository.