Skip to main content

MakeNominal Interface

Use this as the type of a protected field to cause a type to use nominal typing instead of structural.

Signature

/** @sealed */
export interface MakeNominal

Remarks

Using nominal typing in this way prevents assignment of objects which are not instances of this class to values of this class's type. Classes which are used with "instanceof", or are supposed to be instantiated in particular ways (not just made with object literals) can use this to prevent undesired assignments.

Example

protected _typeCheck!: MakeNominal;