Syntax

TypeScript Generic Interface Syntax

In TypeScript, generic interface: writes a reusable typed container — interface Box<T> { value: T; }

Quick Answer

Syntax
interface Box<T> { value: T; }
TypeScriptSyntax

Generic Interface

Code example
interface Box<T> { value: T; }

Writes a reusable typed container.

Learn More

How to generic interface in TypeScript

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

TypeScript Generic Interface Syntax

Use interface Box<T> { value: T; }.

Related Syntax References

Frequently asked questions

What is the TypeScript syntax for generic interface?

Use this pattern: interface Box<T> { value: T; }

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