Since Typescript 4.5:
const foo = /** @type {const} */ ({x: 1});
const bar = /** @type {const} */ ("baz");
Note that the parentheses are required; this is cast syntax, not normal type annotation.
Since Typescript 4.5:
const foo = /** @type {const} */ ({x: 1});
const bar = /** @type {const} */ ("baz");
Note that the parentheses are required; this is cast syntax, not normal type annotation.