Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upconst assertions in JSDoc #30445
Open
const assertions in JSDoc #30445
Labels
Comments
This comment has been minimized.
This comment has been minimized.
|
It's a small difference, but |
This comment has been minimized.
This comment has been minimized.
|
When is planning to implement this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Search Terms
const jsdoc
Suggestion
v3.4 added support for
as constto mark a literal expression as immutable and disable type widening. This feature uses the TypeScript type assertion syntax{} as constor<const>{}.In JS files you can use JSDoc to do type assertions:
/** @type {T} */(v)Unfortunately that doesn't work with const assertions.
This proposes adding support for
/** @type {const} */([1]).An alternative could be
/** @const */([1]).Use Cases
The same as for const assertions in TS files.
Checklist
My suggestion meets these guidelines: