Syntax

TypeScript Record Type Syntax

In TypeScript, record type: types an object with set keys and values — Record<string, number>

Quick Answer

Syntax
Record<string, number>
TypeScriptSyntax

Record Type

Code example
Record<string, number>

Types an object with set keys and values.

Learn More

How to record 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 Record Type Syntax

Use Record<string, number>.

Related Syntax References

Frequently asked questions

What is the TypeScript syntax for record type?

Use this pattern: Record<string, number>

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