1×
Become a member
to unlock all features
Autoplay

    Overload a Function with TypeScript’s Overload Signatures

    typescriptTypeScript
    ^2.0.0

    Some functions may have different return types depending on the types of the arguments with which they’re invoked. Using TypeScript’s function overloads, you can create an overload for each allowed combination of parameter and return types. This way, all type-correct signatures of a function are encoded in the type system and can be surfaced by the TypeScript Language Service within your editor.