Syntax

TypeScript Pick Type Syntax

In TypeScript, pick type: keeps only chosen properties — Pick<User, "id" | "name">

Quick Answer

Syntax
Pick<User, "id" | "name">
TypeScriptSyntax

Pick Type

Code example
Pick<User, "id" | "name">

Keeps only chosen properties.

Learn More

How to pick 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 Pick Type Syntax

Use Pick<User, "id" | "name">.

Related Syntax References

Frequently asked questions

What is the TypeScript syntax for pick type?

Use this pattern: Pick<User, "id" | "name">

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