mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #19375 from spielc/react-json
Add typings for react-json
This commit is contained in:
Vendored
+19
@@ -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;
|
||||
@@ -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)}/>;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user