Build tool generate TypeScript for JSR
hi, I'm looking at publishing my NPM packages to JSR but I'm not sure what the best approach would be for my use case. For my NPM build setup, I use Rollup and some some transforms. One of these transforms is for turning TypeScript into JavaScript but I have others that I use too.
JSR would prefer that you upload TypeScript for better auto generated docs so my hope was that I would be able to just take my current build setup but remove the TypeScript-to-JavaScript transform but I don't think I'm able to get Rollup to generate TypeScript.
does anyone have any suggestion? if turns out Rollup can generate TypeScript that'd be great. Otherwise if there's another build tool that has the Rollup features I need, I'd be interested in learning about that. Other otherwise, if my best option is to just upload pairs of
.js
and .d.ts
files to JSR like I do to NPM, please let me know.
Thanks.4 Replies
Why not just create a jsr.json file and publish the source files as is?
because I have other transforms other than just TypeScript to JavaScript that I use
For the npm publishing yes? But are they needed for jsr publishing?
yep
for anyone else who finds this: you don't need to generate TypeScript files, you can generate JavaScript files that have
// @ts-self-types="./<name>.d.ts
comments at the top (where <name>
is replaced with the name of the file)