meower-media / api-client

A Meower API Client written in Typescript
MIT License
2 stars 1 forks source link

Use a library for type validation #3

Open mybearworld opened 1 month ago

mybearworld commented 1 month ago

https://github.com/meower-media-co/api-client/blob/b009f8f3f17aa3860cb64cc1c2f7269b196f8d37/src/interfaces/post.ts#L75 https://github.com/meower-media-co/api-client/blob/b009f8f3f17aa3860cb64cc1c2f7269b196f8d37/src/interfaces/user.ts#L62

williamhorning commented 1 month ago

while doing the type validation ourselves isn't the greatest, adding zod isn't something i want to do. zod doesn't publish to jsr (yet, see https://github.com/colinhacks/zod/pull/3506) so the only option would be to depend on the node package. i also dislike that idea, as adding zod as a dependency would increase the minified + gzipped size of this package by 5x. i really don't want to depend on external packages other than the eventemitter used, so unless there's a reason to use zod that would make the extra size worth it, id really rather not.

mybearworld commented 1 month ago

Would Valibot be an option then?

williamhorning commented 1 month ago

I still have concerns about bundle size since one of my main goals is to have as few dependencies as possible for this project. The only dependency we have right now is our eventemitter, and that’s because I don’t think we should reimplement that. I’ll reopen this, but this isn’t coming until after the first stable release.

NotFenixio commented 1 month ago

I mean, according to their website the package is only 600 bytes...