-
Notifications
You must be signed in to change notification settings - Fork 52
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
[feature] concise response type alias #77
Comments
Hi Scott, I really like the idea. Just to clarify, when you say optional you mean you would like like to be able to control if they are generated or not? |
My original intent was "optional to use" the aliases. Typescript type definitions are only used at compile time, and there is no additional code generated in the output .js file. So I can't think of any drawbacks of always generating these additional types. Would be up-to the developer to decide which types they want to import and use. |
Really like this idea as well! Ensuring we export both the verbose and the consise types would make them optional to use as well. Should not cause any bundle size issues either for the consumer, as as you mention these are just compile time types |
@scottc - Wanna give this a shot? |
The response types can be quite long, and inconvenient to use.
const x: Promise<ResponseWithBody<200, OkBody> | ResponseWithBody<404, NotFoundBody> | ResponseWithBody<400, BadRequestBody>> = undefined;
I propose generating some concise type aliases.
The alias's should be backwards compatible, optional to use and work as drop in replacements.
The text was updated successfully, but these errors were encountered: