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

Separate input and output types #22

Closed
aoberoi opened this issue May 13, 2021 · 2 comments
Closed

Separate input and output types #22

aoberoi opened this issue May 13, 2021 · 2 comments
Labels
bug Something isn't working typescript Type system specific issue

Comments

@aoberoi
Copy link
Contributor

aoberoi commented May 13, 2021

from #20

Another shortcoming is that there isn't a good separation between "input" types and "output" types. This matters in situations where a method accepts, for example, a Block in its parameters. At call time, a block won't have properties like id - those are assigned by the server. However, the Block type has id set as a non-optional property. This is a real issue and should be handled in a bugfix.

@aoberoi aoberoi added bug Something isn't working typescript Type system specific issue labels May 13, 2021
@ooloth
Copy link

ooloth commented May 16, 2021

Thanks for identifying this! It will be nice for TS to let us omit properties we aren't updating from their default values when sending POST requests, as described here:

typescript forces all the properties id, title, that's why i have created that createTitle()
cause all TitlePropertyValue properties are required

https://github.com/makenotion/notion-sdk-js/discussions/45#discussioncomment-738035

@rhart92
Copy link
Contributor

rhart92 commented Feb 2, 2022

Auto-generated types should resolve this issue as we now have input and output type distinctions.

@rhart92 rhart92 closed this as completed Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typescript Type system specific issue
Projects
None yet
Development

No branches or pull requests

3 participants