node-twitter-api-v2 icon indicating copy to clipboard operation
node-twitter-api-v2 copied to clipboard

Wrong typing (or structure) for some ApiResponseError

Open maximedupre opened this issue 2 years ago • 1 comments

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

maximedupre avatar Aug 04 '22 15:08 maximedupre

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.

alkihis avatar Aug 04 '22 15:08 alkihis

Available in 1.12.5 :)

alkihis avatar Aug 15 '22 19:08 alkihis