Skip to content
TypeScript types for Twitter API objects
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
types Update Status deprecations Jul 28, 2019
.gitignore Generate index file Aug 2, 2018
.npmignore Add npmignore Aug 2, 2018
index.ts Add isFullUser helper function Jul 28, 2019 Add Jul 8, 2018
package.json Add isFullUser helper function Jul 28, 2019
tsconfig.json Generate index file Aug 2, 2018


Version Status Build Status Dependency Status npm bundle size (minified + gzip)

TypeScript definitions for Twitter API objects.

Carefully constructed with the data from over 400,000 Twitter API status objects. Format will match tweet_mode="extended" and include_entities=true parameters set.

Note that the presence of field is not an indication of it being current and accurate part of the documented Twitter API.


npm install --save-dev twitter-d


The main two interfaces provided are Status and User although there are a number of related interfaces like MediaEntity and AdditionalMediaInfo.

import { Status as Tweet, User } from 'twitter-d';

function getTweet(): Tweet { /* ... */ }
function getUser(): User { /* ... */ }

Or if you are using TypeScript 2.9+ you can use import().

function getStatus(): import('twitter-d').Status { /* ... */ }


In some contexts, using trim_user=true on GET statuses/mentions_timeline, you might get a user object that only includes id and id_str. To test if a User value is a FullUser you can use the isFullUser helper function.

import { isFullUser, User } from 'twitter-d';

function logUser(user: User) {
  if (isFullUser(user)) {
  } else {
    throw new Error('User is not type FullUser');


If you find find an inaccuracy please open an issue and include a status or user ID that demonstrates the difference.

You can’t perform that action at this time.