We have a cljs lib which is consumed by our frontend typescript team to handle a bit of complex domain logic. I’d like to make it a bit more friendly for the frontend team. What could I do - e.g. is there a way to make our cljs docstrings appear for them where the use it in typescript? I don’t mind adding some extra annotations, but not sure where or how, or what format.
You might consider writing and including type declarations files with the cljs lib: https://www.typescriptlang.org/docs/handbook/2/type-declarations.html#your-own-definitions
https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html
https://stackoverflow.com/questions/48952313/what-to-put-in-package-json-types-field-for-typescript-based-libs
and somewhere in the package.json file of the cljs library you would include the type defintions, maybe a line like "types": "./dist/index.d.ts",
I haven't tried it myself though, just experimented a bit.
BTW, if the Cljs library is not too complicated, you may consider building it with Squint instead: That way, all the vectors and maps are in fact standard JavaScript arrays and maps which may facilitate consumption from TypeScript even more.
Ooh squint sounds like something worth exploring, thank you
I haven't adopted AI coding assistance myself but maybe writing the Typescript type definition file based on the Clojure code would be a tedious task that it could do for you in case you follow that route 😄
🙂 actually a good use of AI :)
shouldn't @jsdoc annotations be passed through the Closure Compiler and hence be visible?