From 4b342d3cf1fb78b2a092147bf7237713e47d75b6 Mon Sep 17 00:00:00 2001 From: Matthew James Date: Sat, 3 Mar 2018 08:26:02 +0000 Subject: [PATCH] Added usage test --- types/react-resize-detector/index.d.ts | 2 +- .../react-resize-detector-tests.tsx | 31 +++++++++++++++++++ types/react-resize-detector/tsconfig.json | 7 +++-- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 types/react-resize-detector/react-resize-detector-tests.tsx diff --git a/types/react-resize-detector/index.d.ts b/types/react-resize-detector/index.d.ts index cb275de3ff..1bf1ebfb39 100644 --- a/types/react-resize-detector/index.d.ts +++ b/types/react-resize-detector/index.d.ts @@ -21,4 +21,4 @@ interface ReactResizeDetectorProps extends React.Props { declare class ReactResizeDetector extends React.PureComponent { } -export = ReactResizeDetector; +export default ReactResizeDetector; diff --git a/types/react-resize-detector/react-resize-detector-tests.tsx b/types/react-resize-detector/react-resize-detector-tests.tsx new file mode 100644 index 0000000000..785b5cc7fe --- /dev/null +++ b/types/react-resize-detector/react-resize-detector-tests.tsx @@ -0,0 +1,31 @@ +// Adapted from example provided at https://github.com/maslianok/react-resize-detector + +import * as React from "react"; +import * as ReactDOM from "react-dom"; + +import ReactResizeRouter from "./index"; + +class App extends React.PureComponent { + constructor(props: {}) { + super(props); + + this.handleResize = this.handleResize.bind; + } + + render(): JSX.Element { + return
+
Some child content
+ +
; + } + + private handleResize(width: number, height: number) { + console.log(`width = ${width}`); + console.log(`height = ${height}`); + } +} diff --git a/types/react-resize-detector/tsconfig.json b/types/react-resize-detector/tsconfig.json index ecc22c8314..b6f1863fc0 100644 --- a/types/react-resize-detector/tsconfig.json +++ b/types/react-resize-detector/tsconfig.json @@ -2,12 +2,14 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, + "jsx": "react", "baseUrl": "../", "typeRoots": [ "../" @@ -17,6 +19,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "react-resize-detector-tests.tsx" ] }