Bug Report
🔎 Search Terms
satisfies, as const, literal
🕗 Version & Regression Information
- This is a crash
- I was unable to test this on prior versions because
satisfies is new in 4.9.0 beta
⏯ Playground Link
Playground Link
💻 Code
type Colors = "red" | "green" | "blue";
type RGB = readonly [red: number, green: number, blue: number];
type Palette = Readonly<Record<Colors, string| RGB>>;
const palette1 = {
red: [255, 0, 0],
green: "#00ff00",
blue: [0, 0, 255]
// Expect to pass but throws error
} satisfies Palette as const;
🙁 Actual behavior
Fails with error:
'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.
🙂 Expected behavior
No error because it is a literal and satisfies should not change the type. Also, other type assertions work fine, so const should as well.
Bug Report
🔎 Search Terms
satisfies, as const, literal
🕗 Version & Regression Information
satisfiesis new in 4.9.0 beta⏯ Playground Link
Playground Link
💻 Code
🙁 Actual behavior
Fails with error:
🙂 Expected behavior
No error because it is a literal and
satisfiesshould not change the type. Also, other type assertions work fine, soconstshould as well.