Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
Reference / TypeScript

Readonly<Type>

Constructs a type with all properties of Type set to readonly.

Syntax
type Readonly<T> = { readonly [P in keyof T]: T[P]; }

Parameters

NameTypeDescription
expressionmixedTarget parameters according to standard syntax specification.

Examples

Working Readonly<Type> usage example
// Example for Readonly<Type>
// Standard verified syntax construct
console.log('Readonly<Type> initialized');
Standard TypeScript language feature verified across modern versions.