-
Notifications
You must be signed in to change notification settings - Fork 24
Support generic type in ServiceClientResponse #106
Comments
We can add a generic type that default to the union. @cberg-zalando will you push a PR? |
Sure, I can do this. To be backwards compatible, it is just a question what kind of type to assign by default to the generic parameter. I would propose |
I agree to keep the API compatible in 0.11.x. So, I also thought of adding more restriction like: request<T extends (Buffer | string | object) = any>(options) : Promise<T>; but it doesn't work as expected somehow. Also, the parsed JSON type can be a |
I just gave this a revisit as I just didn't have any time to look into this issue before. I have a WIP commit, but I have run into a problem. If add the generic type |
To avoid type clashes due to changes in perron's typings, I looked into bumping the version in translation-manager from 0.11.1 to 0.11.4.
Due to the change from
any
toBuffer | string | object
, this would now require adding type casts throughout the code.Do you see any problem, if we change the API to extend
ServiceClientResponse
with a generic type, which can be then also passed via theServiceClient::request
method?The text was updated successfully, but these errors were encountered: