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

Support void as unknownType #1577

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vitorcamachoo
Copy link

@vitorcamachoo vitorcamachoo commented Feb 25, 2025

We work in an API, and in some cases, it returns an empty payload (404, 202, etc.), and for those cases, we want the void type. Currently, the Kubb configuration only allows unknown and any.
We are migrating from Orval to Kubb, and for those situations, Orval handles them as void which is the most correct in our use case.

Example:
When using a union in Typescript, in which one of the types is unknown or any, the return type is unknown or any.

Copy link

changeset-bot bot commented Feb 25, 2025

⚠️ No Changeset found

Latest commit: 483ca63

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kubb-labs
Copy link

kubb-labs bot commented Feb 25, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-03-04 17:00:18 CET

@vitorcamachoo vitorcamachoo force-pushed the support-void-unknown-type branch 2 times, most recently from 64d83d1 to 14168fa Compare February 25, 2025 18:08
@vitorcamachoo
Copy link
Author

Please let me know if there is anything missing in the code.

@vitorcamachoo vitorcamachoo force-pushed the support-void-unknown-type branch 2 times, most recently from e392503 to e95563a Compare February 26, 2025 15:25
@stijnvanhulle
Copy link
Collaborator

@vitorcamachoo Thanks for opening a pr, really appreciate your work here.
Could you also update the types for unknownType in https://github.com/kubb-project/kubb/blob/1f199b882306088fa10b4b59662698ac45aeafca/packages/plugin-zod/src/types.ts#L50-L50, https://github.com/kubb-project/kubb/blob/1f199b882306088fa10b4b59662698ac45aeafca/packages/plugin-faker/src/types.ts#L53-L53 and https://github.com/kubb-project/kubb/blob/1f199b882306088fa10b4b59662698ac45aeafca/packages/plugin-ts/src/types.ts#L58-L58.

And next to that, updating the docs to also include the new void option.

@stijnvanhulle
Copy link
Collaborator

@all-contributors please add @vitorcamachoo for code

Copy link
Contributor

@stijnvanhulle

I've put up a pull request to add @vitorcamachoo! 🎉

@vitorcamachoo vitorcamachoo force-pushed the support-void-unknown-type branch from e95563a to 97c3f41 Compare March 3, 2025 10:43
@vitorcamachoo
Copy link
Author

vitorcamachoo commented Mar 3, 2025

@vitorcamachoo vitorcamachoo force-pushed the support-void-unknown-type branch 3 times, most recently from 445f00f to 8a4780e Compare March 4, 2025 12:36
@vitorcamachoo vitorcamachoo force-pushed the support-void-unknown-type branch from 8a4780e to 87d47af Compare March 4, 2025 12:37
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.

2 participants