node-twitter-api-v2
node-twitter-api-v2 copied to clipboard
Wrong typing (or structure) for some ApiResponseError
Describe the bug
For example, the error if you upload an invalid image for the profile banner, the ApiResponseError
will have a data
attribute that doesn't respect the typings.
...
data: {
request: '/1.1/account/update_profile_banner.json',
error: 'media type unrecognized.'
}
Yet data
is supposed to be of type TwitterApiErrorData
export interface TwitterApiErrorData {
errors: (ErrorV1 | ErrorV2)[];
title?: string;
detail?: string;
type?: string;
}
To Reproduce Upload an invalid banner
Version
Node.js version: v16.14.0
Lib version: "twitter-api-v2": "^1.12.3"
OS (especially if you use Windows): macOS 12.5
Thanks for the report! Ah, if only Twitter response data could be consistent 🥲 I'll look how I can type/parse that without breaking anything.
Available in 1.12.5 :)