Open this example in the interactive library
Source code
const words = ["build", "ship", "test"];
console.log((<const T,>(v: T) => v)({ kind: "ready", tags: ["api"] }));
Sample output
{ kind: 'ready', tags: [ 'api' ] }
Preserve a literal with a const type parameter using TypeScript.
Open this example in the interactive library
const words = ["build", "ship", "test"];
console.log((<const T,>(v: T) => v)({ kind: "ready", tags: ["api"] }));
{ kind: 'ready', tags: [ 'api' ] }