mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 08:58:23 +08:00
Add react-json-tree (#12304)
This commit is contained in:
committed by
Masahiro Wakame
parent
32cfdbb3f4
commit
53ebd0025c
27
react-json-tree/index.d.ts
vendored
Normal file
27
react-json-tree/index.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// Type definitions for react-json-tree v0.6.5
|
||||
// Project: https://github.com/alexkuz/react-json-tree/
|
||||
// Definitions by: Grant Nestor <https://github.com/gnestor/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import {
|
||||
Component,
|
||||
Props
|
||||
} from "react";
|
||||
|
||||
export interface JSONTreeProps extends Props<JSONTreeComponent> {
|
||||
data: [any] | {};
|
||||
hideRoot?: boolean;
|
||||
theme?: {} | string;
|
||||
invertTheme?: boolean;
|
||||
keyPath?: [string | number];
|
||||
sortObjectKeys?: Function | boolean;
|
||||
shouldExpandNode?: (keyName: string, data: [any] | {}, level: number) => boolean;
|
||||
getItemString?: (type: string, data: [any] | {}, itemType: string, itemString: string) => JSX.Element;
|
||||
labelRenderer?: (raw: [string, string]) => JSX.Element;
|
||||
valueRenderer?: (raw: string) => JSX.Element;
|
||||
postprocessValue?: (raw: string) => JSX.Element;
|
||||
isCustomNode?: () => boolean;
|
||||
collectionLimit?: number;
|
||||
}
|
||||
|
||||
export default class JSONTreeComponent extends Component<JSONTreeProps, {}> { }
|
||||
12
react-json-tree/react-json-tree-tests.tsx
Normal file
12
react-json-tree/react-json-tree-tests.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as React from "react";
|
||||
// import * as ReactDOM from "react-dom";
|
||||
import JSONTree from "react-json-tree";
|
||||
|
||||
<JSONTree data={{
|
||||
string: "string",
|
||||
array: [1, 2, 3],
|
||||
bool: true,
|
||||
object: {
|
||||
foo: "bar"
|
||||
}
|
||||
}} />;
|
||||
20
react-json-tree/tsconfig.json
Normal file
20
react-json-tree/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-json-tree-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user