Skip to main content

Tuple

A Rimbu Tuple is a normal JS/TypeScript Array with fixed length and element types. It's main use is for better type inference in some cases. Also, it contains some utility functions to manipulate tuple contents and create new tuple types by appending or prepending elements in a type-safe way.

The main need for this type is when the TypeScript compiler infers either too strict or too loose types. The example CodeSandbox shows examples of these cases.

Example

Open file below in new window with full type-check