json-typescript
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "json-typescript", | ||
"version": "0.0.2", | ||
"description": "JSON TypeScript type definitions", | ||
"version": "0.0.3", | ||
"description": "TypeScript ambient type definitions for JSON objects", | ||
"main": "index.d.ts", | ||
@@ -6,0 +6,0 @@ "scripts": { |
# 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 type information for compile-time validation of [JSON objects](https://www.json.org/). | ||
TypeScript ambient type information for compile-time validation of [JSON objects](https://www.json.org/). | ||
@@ -11,7 +11,16 @@ ## How to use this | ||
2. Import the types into the files where you wish to use them | ||
```ts | ||
import 'json-typescript'; | ||
2. Include this module in your `tsconfig.json`'s `typeRoots` | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"typeRoots": [ | ||
"node_modules/@types", | ||
"node_modules/json-typescript" | ||
] | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} | ||
``` | ||
> **NOTE:** You can add the types across your whole project by opening your `./global.d.ts` ambient type file (or create an empty file if it doesn't yet exist) and adding the same import | ||
@@ -21,3 +30,2 @@ 3. check to see if json types are validated correctly | ||
```ts | ||
import 'json-typescript'; | ||
@@ -24,0 +32,0 @@ // ✅ This should be OK |
@@ -1,2 +0,1 @@ | ||
import '../../index'; | ||
let o: JSON.Object = [{ foo: 'bar' }]; |
@@ -1,2 +0,1 @@ | ||
import '../../index'; | ||
let o: JSON.Value = { | ||
@@ -3,0 +2,0 @@ b: { |
@@ -1,2 +0,1 @@ | ||
import '../../index'; | ||
let o: JSON.Array = { foo: 'bar' }; |
@@ -1,2 +0,1 @@ | ||
import '../../index'; | ||
let o: JSON.Value = { | ||
@@ -3,0 +2,0 @@ b: { |
@@ -14,3 +14,6 @@ { | ||
"noEmitOnError": true, | ||
"noEmit": true | ||
"noEmit": true, | ||
"lib": [ | ||
"es2015" | ||
] | ||
}, | ||
@@ -21,3 +24,3 @@ "exclude": [ | ||
"include": [ | ||
"index.d.ts", | ||
"json/index.d.ts", | ||
"tests/helpers.ts", | ||
@@ -24,0 +27,0 @@ "tests/**/*test.ts" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8115
18
228
51