utilitypes-ts
    Preparing search index...

    Type Alias Suggestion<Options, Base>

    Suggestion: Options | Base & {}

    Provides autocomplete suggestions while still allowing any value of Base.

    This is useful when you want to suggest a set of known options in editors, but not restrict the type strictly to those options.

    Type Parameters

    • Options extends Base

      Suggested literal values

    • Base = string

      The underlying type (defaults to string)

    type Color = Suggestion<"red" | "blue">;

    const a: Color = "red"; // ✅ suggested
    const b: Color = "green"; // ✅ allowed, not suggested
    type Size = Suggestion<1 | 2 | 3, number>;

    const a: Size = 2; // ✅ suggested
    const b: Size = 10; // ✅ allowed, not suggested