JSON Feed Types

I've been working on adding JSON Feed to my blog, but I was surprised to discover that nobody has published JSON Feed TypeScript types yet. So I made some.

The types will give you confidence that your feed complies with the JSON Feed spec and give you documentation from the spec itself in your editor. Pretty cool!

I've only typed version 1.1 of the spec so far. You can get the types from npm:

npm install --save-dev @json-feed-types/1_1

And then use them to type your feed data:

import Feed from '@json-feed-types/1_1'
const feed: Feed = {
  version: '',
  title: 'JSON Feed',
  icon: '',
  home_page_url: '',
  feed_url: '',
  items: [
      id: '',
      title: 'JSON Feed version 1.1',
        '<p>We&rsquo;ve updated the spec to <a href="">version 1.1</a>. It’s a minor update to JSON Feed, clarifying a few things in the spec and adding a couple new fields such as <code>authors</code> and <code>language</code>.</p>\n\n<p>For version 1.1, we&rsquo;re starting to move to the more specific MIME type <code>application/feed+json</code>. Clients that parse HTML to discover feeds should prefer that MIME type, while still falling back to accepting <code>application/json</code> too.</p>\n\n<p>The <a href="">code page</a> has also been updated with several new code libraries and apps that support JSON Feed.</p>\n',
      date_published: '2020-08-07T11:44:36-05:00',
      url: '',

The types support extensions, too. You can find out more in the readme.

#JSON Feed#TypeScript