• Used for exhaustive if/switch statements Example:

    enum Fruit {
    orange = "orange",
    apple = "apple",
    }

    const getFruitName = (fruit: Fruit): string => {
    if (fruit === Fruit.orange) {
    return "Orange";
    }

    // Should fail TS compilation as Fruit.apple is not being handled in the code above
    return assertUnreachable(fruit);
    }

    Parameters

    • x: never

    Returns never

Generated using TypeDoc