Merge pull request #19375 from spielc/react-json

Add typings for react-json
This commit is contained in:
Mine Starks
2017-08-28 15:28:50 -07:00
committed by GitHub
4 changed files with 67 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for react-json 0.2
// Project: https://github.com/arqex/react-json
// Definitions by: Christoph Spielmann <https://github.com/spielc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as React from 'react';
type OnChangeHandler = (value: any) => void;
interface JsonProperties {
value: any;
onChange?: OnChangeHandler;
}
declare class Json extends React.Component<JsonProperties> {
}
export = Json;
+20
View File
@@ -0,0 +1,20 @@
import * as React from 'react';
import Json from 'react-json';
const TestObject = {
s: "Hello, world",
b: true,
n: 666,
o: {
s: "Hello, world",
b: true,
n: 666,
o: {
s: "Hello, world",
b: true,
n: 666,
}
}
};
<Json value={TestObject} onChange={(val: any) => console.log(val)}/>;
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"allowSyntheticDefaultImports": true
},
"files": [
"index.d.ts",
"react-json-tests.tsx"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}