satisfies support in JSDoc #51086
Labels
Domain: JSDoc
Relates to JSDoc parsing and type generation
In Discussion
Not yet reached consensus
Suggestion
An idea for TypeScript
Suggestion
π Search Terms
satisfies, jsdoc
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
It would be fantastic to have
satisfies
support in jsdoc. This was previously discussed in the satisfies PR (with the suggestion to open a separate tracking issue) and in the 8/17/2022 Design Meeting.There was a discussion about using
/** @type {satisfies T} */
, but I would love to see TS be more opinionated on this and go for/** @satisfies {T} */
.Two main reasons:
satisfies
clause. There aren't great reasons to do this, but the fewer functionality differences between ts and jsdoc the better.The design meeting mentioned:
But: unknown tags are common in the wild and
jsdoc
(the utility) hasallowUnknownTags
set by default, so@satisfies
information isn't included in the generated docs, but it also doesn't cause any errors. Parser-wise, it should also be relatively easy to support in the future, if there's a desire.The syntax ship has definitely sailed, in contrast. TS hasn't added tags before AFAIK, but common TS-specific syntax is already often not parsed and causes errors (e.g.
/** @type {{name: string}[]} */ const arr = [];
).π Motivating Example
π» Use Cases
satisfies
in jsdoc!The text was updated successfully, but these errors were encountered: