Syntax

TypeScript Get a Type with typeof Syntax

In TypeScript, get a type with typeof: creates a type from a value — type Config = typeof config;

Quick Answer

Syntax
type Config = typeof config;
TypeScriptSyntax

Get a Type with typeof

Code example
type Config = typeof config;

Creates a type from a value.

Learn More

How to get a type with typeof in TypeScript

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

TypeScript Get a Type with typeof Syntax

Use type Config = typeof config;.

Related Syntax References

Frequently asked questions

What is the TypeScript syntax for get a type with typeof?

Use this pattern: type Config = typeof config;

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