mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 19:51:53 +00:00
Add typings for react-json 0.2!
This commit is contained in:
Vendored
+16
@@ -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, {}> {
|
||||
}
|
||||
@@ -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)}/>;
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user