Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

11
JSDoc 'as const' equivalent?
Post Body

I'm in an old project that is too huge to easily convert to Typescript, so I've been using JSDoc instead. The Typescript feature that I can't figure out how to replicate in JSDoc is using as const to fully type the property names and values of an object.

ts // In Typescript const anObject = {hello: 'world'} as const; // (type shows as {hello:'world'} instead of {hello:string}

Is there any equivalent for this in JSDoc? I've been completely unable to find anything that does this, so instead I have to basically copy-paste any static object as a type to be able to properly type these cases, which certainly isn't DRY.

Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,589
Link Karma
1,001
Comment Karma
575
Profile updated: 3 days ago
Posts updated: 10 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago