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.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

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;