mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
Add typings for react-json-pretty
This commit is contained in:
21
react-json-pretty/index.d.ts
vendored
Normal file
21
react-json-pretty/index.d.ts
vendored
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
17
react-json-pretty/react-json-pretty-tests.tsx
Normal file
17
react-json-pretty/react-json-pretty-tests.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
}
|
||||
21
react-json-pretty/tsconfig.json
Normal file
21
react-json-pretty/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
react-json-pretty/tslint.json
Normal file
1
react-json-pretty/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user