You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change JSDoc @typedef to not apply to following expression
π Motivating Example
Using @typedef like interface is great for JS files. But if any expression comes after it, TypeScript tries to apply that typedef to that expression. This means we have to make sure to put it at the end of a file and make sure nothing comes after it. Not ideal.
π» Use Cases
See above.
The text was updated successfully, but these errors were encountered:
@typedef is usually supposed to be independent of the following statement, except for grabbing its name if you leave it off. It definitely should not apply the defined type to the following expression.
Any example I can think of is a bug, so please do post any you find.
Suggestion
π Search Terms
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Change JSDoc
@typedef
to not apply to following expressionπ Motivating Example
Using
@typedef
likeinterface
is great for JS files. But if any expression comes after it, TypeScript tries to apply that typedef to that expression. This means we have to make sure to put it at the end of a file and make sure nothing comes after it. Not ideal.π» Use Cases
See above.
The text was updated successfully, but these errors were encountered: