From 26c9c3ddf584cbdd38b5829a6ca3666864966efe Mon Sep 17 00:00:00 2001 From: Christoph Spielmann Date: Sun, 27 Aug 2017 17:30:24 +0200 Subject: [PATCH] Add typings for react-json 0.2! --- types/react-json/index.d.ts | 16 ++++++++++++++++ types/react-json/react-json-tests.tsx | 26 ++++++++++++++++++++++++++ types/react-json/tsconfig.json | 24 ++++++++++++++++++++++++ types/react-json/tslint.json | 1 + 4 files changed, 67 insertions(+) create mode 100644 types/react-json/index.d.ts create mode 100644 types/react-json/react-json-tests.tsx create mode 100644 types/react-json/tsconfig.json create mode 100644 types/react-json/tslint.json diff --git a/types/react-json/index.d.ts b/types/react-json/index.d.ts new file mode 100644 index 0000000000..c52cabcd6b --- /dev/null +++ b/types/react-json/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for react-json 0.2 +// Project: https://github.com/arqex/react-json +// Definitions by: Christoph Spielmann +// 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 { +} diff --git a/types/react-json/react-json-tests.tsx b/types/react-json/react-json-tests.tsx new file mode 100644 index 0000000000..05e12fa9f9 --- /dev/null +++ b/types/react-json/react-json-tests.tsx @@ -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 console.log(val)}/>; + } +} diff --git a/types/react-json/tsconfig.json b/types/react-json/tsconfig.json new file mode 100644 index 0000000000..ff5be5812c --- /dev/null +++ b/types/react-json/tsconfig.json @@ -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" + ] +} diff --git a/types/react-json/tslint.json b/types/react-json/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-json/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }