Open jam-fran opened 1 year ago
The type definition for TweetEntitiesV2 currently requires all properties:
export interface TweetEntitiesV2 { annotations: TweetEntityAnnotationsV2[]; urls: TweetEntityUrlV2[]; hashtags: TweetEntityHashtagV2[]; cashtags: TweetEntityHashtagV2[]; mentions: TweetEntityMentionV2[]; }
However, fetching a singleTweet() often returns only a partial entities object if the tweet does not contain all of the entities. For example, below is a raw entities response from Twitter that leads to a type error:
singleTweet()
"entities": { "mentions": [ { "start": 229, "end": 239, "username": "Cristiano", "id": "155659213" }, { "start": 257, "end": 267, "username": "AlNassrFC", "id": "523926217" } ], "urls": [ { "start": 268, "end": 291, "url": "https://t.co/oan7nu8NWC", "expanded_url": "https://twitter.com/AlNassrFC_EN/status/1608935670520909825/photo/1", "display_url": "pic.twitter.com/oan7nu8NWC", "media_key": "3_1608935659972038657" }, { "start": 268, "end": 291, "url": "https://t.co/oan7nu8NWC", "expanded_url": "https://twitter.com/AlNassrFC_EN/status/1608935670520909825/photo/1", "display_url": "pic.twitter.com/oan7nu8NWC", "media_key": "3_1608935659519049734" } ] },
I would make a small PR myself but I'm a noob and haven't contributed before so wouldn't be exactly sure what to do 🤦
The type definition for TweetEntitiesV2 currently requires all properties:
However, fetching a
singleTweet()
often returns only a partial entities object if the tweet does not contain all of the entities. For example, below is a raw entities response from Twitter that leads to a type error:I would make a small PR myself but I'm a noob and haven't contributed before so wouldn't be exactly sure what to do 🤦