Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-typescript

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-typescript - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

json/index.d.ts

4

package.json
{
"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"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc