Socket
Socket
Sign inDemoInstall

jsonapi-typescript

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jsonapi-typescript

TypeScript definitions for JSON-API


Version published
Weekly downloads
2.9K
decreased by-26.76%
Maintainers
1
Install size
580 kB
Created
Weekly downloads
 

Changelog

Source

0.1.3 (2019-04-10)

Bug Fixes

  • lint fixes (3f18d08)
  • v0.1.2 (0a87710)

Readme

Source

JSONAPI-typescript

Build Status Version

TypeScript type information for compile-time validation of JSON:API documents. Supports TS 2.3 and above.

How to use this

  1. Install this package
npm install --save-dev jsonapi-typescript
  1. Import this module
import * as JSONAPI from 'jsonapi-typescript';
  1. check to see if json types are validated correctly
import * as JSONAPI from 'jsonapi-typescript';

// ✅ This should be OK
let doc: JSONAPI.Document = {
  data: {
    type: 'articles',
    id: '1'
  }
};

// ⛔️ This should NOT be OK ("result" is not a valid JSON:API top-level key)
let doc: JSONAPI.Document = {
  result: "Success!"
};

// ⛔️ This should NOT be OK ( empty Array is not a valid JSON:API document )
let doc: JSONAPI.Document = [];

© 2017 Mike North, All Rights Reserved.

Keywords

FAQs

Last updated on 10 Apr 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc