Closed aryaemami59 closed 4 months ago
Thanks. I am using TypeScript only for webapps where I anyway have a build step.
In Size Limit I don’t have build step right now (files in node_modules/size-limit
is exact files from the Github). Adding build step (needed for TS) will increase maintainability too much (which will not cover the benefits of types).
@ai
Thanks. I am using TypeScript only for webapps where I anyway have a build step.
In Size Limit I don’t have build step right now (files in
node_modules/size-limit
is exact files from the Github). Adding build step (needed for TS) will increase maintainability too much (which will not cover the benefits of types).
That's actually part of the reason why I suggested it, we're currently using size-limit in Redux-toolkit, and we ended up running into some CJS/ESM compatibility issues, I was thinking if we convert the codebase the TypeScript we can then use tsup to make this package dual compatible with both ESM and CJS, that way people using the API can get the benefit of types and on top of that the package itself becomes more accessible and user friendly. I completely understand if this is something you wouldn't want to do however. If you want I can put together a POC, just so you'll see what it looks like and if you still don't want to do it, we'll leave it as is. Thoughts?
We can add .d.ts
files for types for public API, it is a simpler way.
I tried dual compatible with both ESM and CJS for Nano ID for years and my experience that it is just not possible yet in 100% cases, but requires a lot of resources (in real scale). This is why I right now prefer or pure CJS (for popular libraries) or pure ESM. It is so much simpler to support.
@ai That's fair enough. I'm glad you're at least open to the idea of adding types though. Let me know if you ever change your mind about this, as far as adding .d.ts
files, I don't love the idea but I can definitely do that, I will do whatever that helps.
I am willing to put up a PR for this today if it's up for consideration.