Socket
Socket
Sign inDemoInstall

json-typescript

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.6 to 0.0.7

index.ts

16

package.json
{
"name": "json-typescript",
"version": "0.0.6",
"description": "TypeScript ambient type definitions for JSON objects",
"main": "index.d.ts",
"version": "0.0.7",
"description": "TypeScript type definitions for JSON objects",
"main": "index.ts",
"scripts": {

@@ -13,9 +13,7 @@ "test": "tsc && ./node_modules/.bin/mocha --opts tests/mocha.opts",

"type": "git",
"url": "git+https://github.com/mike-north/json.ts.git"
"url": "git+https://github.com/mike-north/json-typescript.git"
},
"keywords": [
"jsonapi",
"typescript",
"ember-data",
"emberjs"
"typescript"
],

@@ -25,5 +23,5 @@ "author": "Mike North <michael.l.north@gmail.com> (https://mike.works)",

"bugs": {
"url": "https://github.com/mike-north/json.ts/issues"
"url": "https://github.com/mike-north/json-typescript/issues"
},
"homepage": "https://github.com/mike-north/json.ts#readme",
"homepage": "https://github.com/mike-north/json-typescript#readme",
"devDependencies": {

@@ -30,0 +28,0 @@ "@types/chai": "^4.0.10",

@@ -1,4 +0,6 @@

# JSON.ts <a href="https://travis-ci.org/mike-north/json.ts" align='right'><img src="https://travis-ci.org/mike-north/json.ts.svg?branch=master"></a>
TypeScript ambient type information for compile-time validation of [JSON objects](https://www.json.org/).
# JSON-typescript <a href="https://travis-ci.org/mike-north/json-typescript" align='right'><img src="https://travis-ci.org/mike-north/json-typescript.svg?branch=master"></a>
TypeScript type information for compile-time validation of [JSON objects](https://www.json.org/).
[![Greenkeeper badge](https://badges.greenkeeper.io/mike-north/json-typescript.svg)](https://greenkeeper.io/)
## How to use this

@@ -11,23 +13,14 @@

2. Include this module in your `tsconfig.json`'s `typeRoots`
```json
{
"compilerOptions": {
"typeRoots": [
"node_modules/@types",
"node_modules/json-typescript"
]
},
"exclude": [
"node_modules"
]
}
2. Import this package
```ts
import _JSON from 'json-typescript';
```
3. check to see if json types are validated correctly
3. Check to see if json types are validated correctly
```ts
import _JSON from 'json-typescript';
// ✅ This should be OK
let doc: JSON.Value = {
let doc: _JSON.Value = {
data: {

@@ -40,3 +33,3 @@ type: 'articles',

// ⛔️ This should NOT be OK ( functions are not allowed )
let doc: JSON.Value = {
let doc: _JSON.Value = {
foo() {

@@ -48,6 +41,6 @@ return bar;

// ⛔️ This should NOT be OK ( Array is not a JSON.Object )
let doc: JSON.Object = [];
let doc: _JSON.Object = [];
```
## Copyright
&copy; 2017 [Mike North](https://github.com/mike-north), All Rights Reserved.
&copy; 2018 [Mike North](https://github.com/mike-north), All Rights Reserved.

@@ -15,3 +15,3 @@ {

"include": [
"json",
"index.ts",
"tests/helpers.ts",

@@ -18,0 +18,0 @@ "tests/**/*test.ts"

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc