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

patch(return types): union return type with undefined. #33

Merged
merged 4 commits into from
Jan 3, 2024

Conversation

seriouslag
Copy link
Collaborator

@seriouslag seriouslag commented Jan 2, 2024

React query data is in union with undefined by default.
Previously, we were overriding the default data type of react query.
This causes the issue where the default return type was never marked as undefined.
It should always be possible for the default data to be undefined.

Now we union with undefined.

Exporting the default return type, closes #32

Re-did some of the typings to make it easier to change types.
Added to the example showing how to override the return type for the data, which was addressed in #29

Now, the generator passes the open API descriptions as JSDoc comments to the generated hooks and marks the methods as depreciated if marked in the spec. This closes: #18

Showing undefined listed in union on return type (as react query would do)
image

New JSDoc:
image

With deprecated indicator:
image

Exporting helper types for consumers if they need:

image

@seriouslag seriouslag force-pushed the patch/make-return-type-undefind branch 2 times, most recently from 86bac1b to 4beef64 Compare January 3, 2024 00:23
React query data is undefined by default.
Previously we were overriding the default type of react query.
Now union with undefined.
We are also exporting the data type.
@seriouslag seriouslag force-pushed the patch/make-return-type-undefind branch from 4beef64 to b0f2f6d Compare January 3, 2024 00:41
@seriouslag seriouslag marked this pull request as draft January 3, 2024 03:44
@seriouslag seriouslag marked this pull request as ready for review January 3, 2024 05:03
@7nohe
Copy link
Owner

7nohe commented Jan 3, 2024

@seriouslag Thank you for the PR! Everything looks good 👍🏼

@7nohe 7nohe merged commit af2fea7 into 7nohe:main Jan 3, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return types of query results Respect deprecated properties
3 participants