Type AliasFromTypeOfName<TypeOfName>

FromTypeOfName<TypeOfName>: TypeOfTypesMapping[TypeOfName]

Get the type from the name returned by typeof.

Type Parameters

  • TypeOfName extends TypeOfNames

    The name of the type that may be returned by !typeof. This is useful when type manipulation requires a mapping between the return value of !typeof and their corresponding types.

const a: FromTypeOfName<"boolean">;  // a is boolean
const b: FromTypeOfname<"string">; // b is string
const c: FromTypeOfname<"number" | "undefined">; // c is number | undefined