TypeScript Concepts

Assignability — checking a target contract

Assignability asks whether the checker permits a source value or type in a target context. The relation is directional; assigning a narrow literal to a broader type need not permit the reverse. It is affected by compiler options, structural members and special types such as any; it is not a proof of runtime correctness. Observed output: 'ready'. Local example verified with TypeScript 5.8.3, strict checking, ES2022/CommonJS and Node.js 22.16.0; declarations enabled.

Formal Syntax & Structure

typescript syntaxtypescript
const target: Target = source;

Working Example

Example Snippettypescript
let state: "ready" = "ready";const label: string = state;console.log(label);
TypeScript Reference