DEV Community

Discussion on: The Typescript "as const" trick

Collapse
 
orta profile image
Orta • Edited

Somehow I ended up back in this article while looking for something else, so it only seems right to note that JSDoc as consts exists nowadays

const b = /** @type {const} */ ({
  b: "thingy"
})

b.b // will be "thingy" in the type system
//^?
Enter fullscreen mode Exit fullscreen mode

( Also a big fan of your work, I completed Crashlands back when it came out on iOS )