Package Exports
- json-typescript
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (json-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
JSON-typescript
TypeScript type information for compile-time validation of JSON objects.
How to use this
- Install this package
npm install --save-dev json-typescript- Import this package
import * as _JSON from 'json-typescript';- Check to see if json types are validated correctly
import * as { Value as JSONValue, Object as JSONObject } from 'json-typescript';
// ✅ This should be OK
let doc: JSONValue = {
data: {
type: 'articles',
id: '1'
}
};
// ⛔️ This should NOT be OK ( functions are not allowed )
let doc: JSONValue = {
foo() {
return bar;
}
};
// ⛔️ This should NOT be OK ( Array is not a JSONObject )
let doc: JSONObject = [];Copyright
© 2018 Mike North, All Rights Reserved.