liveBook · Manning

Optional type property

An optional type property is an object or schema property that may be omitted from a value without violating its declared requirements.

How 2 Manning books explain it

The Design of Web APIs, Second Edition

An optional property is an object property that need not be present in an instance because its name is absent from the applicable required list.

How it is used
Defines whether API consumers may omit object properties or whether an API may omit them from responses.
How deep it goes
Explains required lists, nested object schemas, and backward-compatible input changes, but does not detail validation implementation.
Examples
Uses Product fields, a nested supplier object, and an optional transfer reason object to demonstrate omission and conditional requirements.
What you can do after
Configure JSON Schema required lists and assess whether API input or output changes remain compatible.

Read how The Design of Web APIs, Second Edition explains optional type property →

Essential TypeScript 5, Third Edition

An optional property is an object property that a TypeScript interface or shape type permits to be absent.

How it is used
Accommodates irregular object collections and interface implementations where some properties or methods are not shared by every object.
How deep it goes
Explains declaration syntax, shape matching, undefined results, and conditional method checks, but does not descend into compiler internals.
Examples
Uses product objects with an optional waterproof flag and Person implementations with an optional dog name and method.
What you can do after
Apply it in TypeScript shapes and interfaces while checking optional values and methods before use.

Read how Essential TypeScript 5, Third Edition explains optional type property →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.