Add typings for react-json-pretty

This commit is contained in:
Karol Janyst
2017-01-26 14:53:33 +09:00
parent ac045ed202
commit dc32857218
4 changed files with 60 additions and 0 deletions

21
react-json-pretty/index.d.ts vendored Normal file
View File

@@ -0,0 +1,21 @@
// Type definitions for react-json-pretty 1.3
// Project: https://github.com/chenckang/react-json-pretty
// Definitions by: Karol Janyst <https://github.com/LKay>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { ComponentClass, HTMLProps } from "react";
export as namespace JSONPretty;
export = JSONPretty;
declare const JSONPretty: JSONPretty;
type JSONPretty = ComponentClass<JSONPretty.JSONPrettyProps>;
declare namespace JSONPretty {
export interface JSONPrettyProps extends HTMLProps<JSONPretty> {
json: {} | string;
}
}

View File

@@ -0,0 +1,17 @@
import * as React from "react";
import * as JSONPretty from "react-json-pretty";
export class Test extends React.Component<any, any> {
render() {
const json = {
foo: "bar"
}
return (
<div>
<JSONPretty json={ json } />
<JSONPretty json={ JSON.stringify(json) } />
</div>
);
}
}

View File

@@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"jsx": "preserve",
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-json-pretty-tests.tsx"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }