Provides autocomplete suggestions while still allowing any value of Base.
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.
Suggested literal values
The underlying type (defaults to string)
string
type Color = Suggestion<"red" | "blue">;const a: Color = "red"; // ✅ suggestedconst b: Color = "green"; // ✅ allowed, not suggested Copy
type Color = Suggestion<"red" | "blue">;const a: Color = "red"; // ✅ suggestedconst b: Color = "green"; // ✅ allowed, not suggested
type Size = Suggestion<1 | 2 | 3, number>;const a: Size = 2; // ✅ suggestedconst b: Size = 10; // ✅ allowed, not suggested Copy
type Size = Suggestion<1 | 2 | 3, number>;const a: Size = 2; // ✅ suggestedconst b: Size = 10; // ✅ allowed, not suggested
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.