1×
Become a member
to unlock all features
Autoplay

    Specify Exact Values with TypeScript’s Literal Types

    typescriptTypeScript
    ^2.0.0

    A literal type is a type that represents exactly one value, e.g. one specific string or number. You can combine literal types with union types to model a finite set of valid values for a variable. In this lesson, we explore the all kinds of literal types in TypeScript:

    • String literal types
    • Numeric literal types
    • Boolean literal types
    • Enum literal types