Open deyaaeldeen opened 1 year ago
Thanks for the proposal! The current implementation didn't consider the streaming situations becuase every operation could return HttpNodeStreamResponse
and HttpBrowserStreamResponse
. So the type systems may fail to suggest the unexpected response if different operations have different default response shapes. The type system would always return the first one matched.
export function isUnexpected(
response:
| StringGetNotProvided200Response
| StringGetNotProvidedDefaultResponse
| HttpBrowserStreamResponse // Adding stream response
| HttpNodeStreamResponse
): response is StringGetNotProvidedDefaultResponse;
export function isUnexpected(
response:
| StringGetBase64Encoded200Response
| StringGetBase64EncodedDefaultResponse
| HttpBrowserStreamResponse // Adding stream response
| HttpNodeStreamResponse
): response is StringGetBase64EncodedDefaultResponse;
I may re-think if we have a better way to solve this and feel free to share your ideas!
isUnexpected
is generated with overloads where each one corresponds to a REST API call. However, it doesn't take into account situations when the customer calls.asNodeStream
or.asBrowserStream
. We expect overloads forHttpNodeStreamResponse
andHttpBrowserStreamResponse
to be supported.Here is my proposal: