Syntax

TypeScript Intersection Type Syntax

In TypeScript, intersection type: combines several types into one — type Admin = User & { role: string };

Quick Answer

Syntax
type Admin = User & { role: string };
TypeScriptSyntax

Intersection Type

Code example
type Admin = User & { role: string };

Combines several types into one.

Learn More

How to intersection 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 Intersection Type Syntax

Use type Admin = User & { role: string };.

Related Syntax References

Frequently asked questions

What is the TypeScript syntax for intersection type?

Use this pattern: type Admin = User & { role: string };

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