Syntax

TypeScript Tuple Type Syntax

In TypeScript, tuple type: types a fixed-length array — const point: [number, number] = [1, 2];

Quick Answer

Syntax
const point: [number, number] = [1, 2];
TypeScriptSyntax

Tuple Type

Code example
const point: [number, number] = [1, 2];

Types a fixed-length array.

Learn More

How to tuple type in TypeScript

  1. Open your TypeScript file or editor.
  2. Copy the example, then replace its sample names and values for your code.

TypeScript Tuple Type Syntax

Use const point: [number, number] = [1, 2];.

Related Syntax References

Frequently asked questions

What is the TypeScript syntax for tuple type?

Use this pattern: const point: [number, number] = [1, 2];

Can I copy this TypeScript code example?

Yes. Use Copy code and adapt the example to your program.

Is this TypeScript syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify