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
I find many times myself using mobx esm bundled js file which is available in the dist folder of the downloaded mobx package from npmjs. This is only done to avoid compiling in the development stage. However, like this, I find myself missing JSDoc descriptions and TypeScript types.
Quick and dirty solution.
I have personally used rollup and rollup-plugin-dts to generate such a file. I am labeling this solution as dirty since it increases dependencies.
A better solution.
You can write (manually) all your public in a single file called index.d.ts, and by that I mean both JSDoc comments and TypeScript types. The implementation of the public and private api should derive its types from that file.
By the way that file can act like documentation, and README.md section about documentation should link to it.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Why?
I find many times myself using mobx esm bundled js file which is available in the dist folder of the downloaded mobx package from npmjs. This is only done to avoid compiling in the development stage. However, like this, I find myself missing JSDoc descriptions and TypeScript types.
Quick and dirty solution.
I have personally used
rollup
androllup-plugin-dts
to generate such a file. I am labeling this solution as dirty since it increases dependencies.A better solution.
You can write (manually) all your public in a single file called
index.d.ts
, and by that I mean both JSDoc comments and TypeScript types. The implementation of the public and private api should derive its types from that file.By the way that file can act like documentation, and
README.md
section about documentation should link to it.Beta Was this translation helpful? Give feedback.
All reactions