Add typings for react-json 0.2!

This commit is contained in:
Christoph Spielmann
2017-08-27 17:30:24 +02:00
parent 7c3257b794
commit 26c9c3ddf5
4 changed files with 67 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// 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
import * as React from 'react';
export type OnChangeHandler = (value: any) => void;
export interface JsonProperties {
value: any;
onChange?: OnChangeHandler;
}
export class Json extends React.Component<JsonProperties, {}> {
}
+26
View File
@@ -0,0 +1,26 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
// import * as Json from 'react-json';
import { Json } from "react-json";
let TestObject = {
s: "Hello, world",
b: true,
n: 666,
o: {
s: "Hello, world",
b: true,
n: 666,
o: {
s: "Hello, world",
b: true,
n: 666,
}
}
};
export class TestComponent extends React.Component<{}, {}> {
render(): JSX.Element {
return <Json value={TestObject} onChange={val => console.log(val)}/>;
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-json-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }