Syntax

TypeScript Unknown Type Syntax

In TypeScript, unknown type: a safe alternative to any that must be narrowed — let value: unknown;

Quick Answer

Syntax
let value: unknown;
TypeScriptSyntax

Unknown Type

Code example
let value: unknown;

A safe alternative to any that must be narrowed.

Learn More

How to unknown 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 Unknown Type Syntax

Use let value: unknown;.

Related Syntax References

Frequently asked questions

What is the TypeScript syntax for unknown type?

Use this pattern: let value: unknown;

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