From 7092c0f044a0d167d140c33fd5657fe7a2e7d6e0 Mon Sep 17 00:00:00 2001 From: Harry Goode <54032035+hrngoode@users.noreply.github.com> Date: Thu, 30 Jan 2020 21:20:21 +0000 Subject: [PATCH] Feature/react d3 graph (#41953) * react-d3-graph types This is our first time submitting something to this git repo. This is the type definition for the node module 'react-d3-graph'. * Test added * tests fixed * Update package.json * Update react-d3-graph-tests.tsx * Update package.json * Delete package.json * Create tslint.json * Update index.d.ts * Update react-d3-graph-tests.tsx * Update package.json --- types/react-d3-graph/index.d.ts | 32 +++++++++++++++++++ types/react-d3-graph/react-d3-graph-tests.tsx | 14 ++++++++ types/react-d3-graph/tsconfig.json | 24 ++++++++++++++ types/react-d3-graph/tslint.json | 1 + 4 files changed, 71 insertions(+) create mode 100644 types/react-d3-graph/index.d.ts create mode 100644 types/react-d3-graph/react-d3-graph-tests.tsx create mode 100644 types/react-d3-graph/tsconfig.json create mode 100644 types/react-d3-graph/tslint.json diff --git a/types/react-d3-graph/index.d.ts b/types/react-d3-graph/index.d.ts new file mode 100644 index 0000000000..f787497e2a --- /dev/null +++ b/types/react-d3-graph/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for react-d3-graph 2.3 +// Project: https://github.com/danielcaldas/react-d3-graph#readme +// Definitions by: hrngoode +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Component } from "react"; + +export class Graph extends Component { + constructor(props: any, ...args: any[]); + + UNSAFE_componentWillReceiveProps(nextProps: any): any; + + componentDidMount(): void; + + componentDidUpdate(): void; + + componentWillUnmount(): void; + + render(): any; +} + +export class Link extends Component { + constructor(...args: any[]); + + render(): any; +} + +export class Node extends Component { + constructor(...args: any[]); + + render(): any; +} diff --git a/types/react-d3-graph/react-d3-graph-tests.tsx b/types/react-d3-graph/react-d3-graph-tests.tsx new file mode 100644 index 0000000000..e8cf7e6c36 --- /dev/null +++ b/types/react-d3-graph/react-d3-graph-tests.tsx @@ -0,0 +1,14 @@ +import { Graph, Link, Node } from "react-d3-graph"; +import * as React from 'react'; + +export class Example extends React.Component { + render(): React.ReactElement { + return ( +
+ + + +
+ ); + } +} diff --git a/types/react-d3-graph/tsconfig.json b/types/react-d3-graph/tsconfig.json new file mode 100644 index 0000000000..f51bc77575 --- /dev/null +++ b/types/react-d3-graph/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-d3-graph-tests.tsx" + ] +} diff --git a/types/react-d3-graph/tslint.json b/types/react-d3-graph/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-d3-graph/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }