TypeScript definitions for JSON-API
npm install jsonapi-typescript

TypeScript type information for compile-time validation of JSON:API documents. Supports TS 2.3 and above.
1. Install this package
``js`
npm install --save-dev jsonapi-typescript
2. Import this module
`ts`
import * as JSONAPI from 'jsonapi-typescript';
3. check to see if json types are validated correctly
`ts
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 = [];
``