-
-
Notifications
You must be signed in to change notification settings - Fork 935
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
Error TS since update to 14.4.1 : responseType does not exists on type "OptionsOfUnknownResponseBody" #2357
Comments
// @spence-s |
I tried reproducing but it works fine for me and correctly resolves to the OptionsOfJSONResponseBody (using node 20): After you updated the package did you run What version of typescript are you using? It's possible that an older version may not resolve correctly. |
@spence-s I'm in typescript 5.4.5 but it's my bad. I create a proxy function to capture and format errors with more readable logic for us (retrieve body and simplify error) : /**
* Wrapper to got library
*
* @param uri - URI to request
* @param options - Got options
* @returns Request's response
*/
export const got = async (uri: string | URL, options?: OptionsOfUnknownResponseBody) => {
try {
return await originGot(uri, options);
} catch (err) {
throw new GotError(err as RequestError);
}
}; But i made a mistake in it. How to retrieve a type with all available options to replace |
Oh I see 😄 . You should change it to Let me know if that works for your use case now. I need to go back and update the types documentation a bit. |
Thanks, it works fine. Sorry for this ticket 😅 |
Describe the bug
Actual behavior
After update to got 14.4.1 I have several errors in got usage when I pass the property
responseType
. This is an error TS2353 said responseType does not exists on type "OptionsOfUnknownResponseBody" :After research, the problems is due to modifications introduced by #2353.
Expected behavior
All works fine, same as oldest versions
Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: