Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use zod for better typings #218

Open
techsavvyash opened this issue Oct 4, 2023 · 4 comments
Open

use zod for better typings #218

techsavvyash opened this issue Oct 4, 2023 · 4 comments

Comments

@techsavvyash
Copy link

techsavvyash commented Oct 4, 2023

Since the API is built using typescript, hence using zod to enforce better types especially for type checking he results of API calls might be a good idea.

@mms-gianni
Copy link
Member

Still reading the docs. But still not 100% clear how and where to use it. I think it could improve the quality.

Found it by accident this project 😄
https://github.com/streetwriters/notesnook/blob/master/servers/themes/package.json#L18

@techsavvyash
Copy link
Author

One of the reference areas of use could be to verify the results of API calls. For example as I am working on the onedev integration, I am required to perform a lot API calls to the onedev API, and even though I have defined custom types for the responses from the onedev API, there is no checking of those types, that's where I got the idea of integrating zod in the code base. You can have a look at the latest commit of #210 for reference.

@mms-gianni
Copy link
Member

I finally think we should do this. Feel free to use it in your PR.

We will add this to the other API endpoints later.

@techsavvyash
Copy link
Author

Thanks for the alignment, will start using it.

@mms-gianni mms-gianni added the UI label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants