add types for jsonic (#25671)

This commit is contained in:
Rong Shen
2018-05-11 04:34:27 +08:00
committed by Sheetal Nandi
parent 478994240a
commit 9cd7841a26
4 changed files with 43 additions and 0 deletions

19
types/jsonic/index.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
// Type definitions for jsonic 0.3
// Project: https://github.com/rjrodger/jsonic
// Definitions by: Rong SHen <https://github.com/jacobbubu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function jsonic(text: string): any;
declare namespace jsonic {
interface Options {
depth?: number;
maxitems?: number;
maxchars?: number;
omit?: string[];
exclude?: string[];
}
function stringify(val: any, opts?: Options): string;
}
export = jsonic;

View File

@@ -0,0 +1,7 @@
import * as jsonic from "jsonic";
jsonic("a:x, b:y z");
jsonic.stringify(
{ a: "a", b: "b", c: { c1: "c1" } },
{ depth: 1, omit: ["a"], exclude: ["b"] }
);

View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "jsonic-tests.ts"]
}

1
types/jsonic/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }