From 02177ef0136a4e7bc763f88a0b3d93e07451aca7 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Mon, 8 Oct 2018 17:55:13 +0200 Subject: [PATCH] Add typings for react-sticky-box package (#29534) --- types/react-sticky-box/index.d.ts | 22 ++++++++++++++++ .../react-sticky-box-tests.tsx | 19 ++++++++++++++ types/react-sticky-box/tsconfig.json | 26 +++++++++++++++++++ types/react-sticky-box/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/react-sticky-box/index.d.ts create mode 100644 types/react-sticky-box/react-sticky-box-tests.tsx create mode 100644 types/react-sticky-box/tsconfig.json create mode 100644 types/react-sticky-box/tslint.json diff --git a/types/react-sticky-box/index.d.ts b/types/react-sticky-box/index.d.ts new file mode 100644 index 0000000000..50315b95e5 --- /dev/null +++ b/types/react-sticky-box/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-sticky-box 0.7 +// Project: https://github.com/codecks-io/react-sticky-box +// Definitions by: Konstantin Lebedev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +declare namespace ReactStickyBox { + type StickyBoxMode = 'relative' | 'stickyBottom' | 'stickyTop'; + + interface StickyBoxProps { + bottom?: boolean; + offsetTop?: number; + offsetBottom?: number; + onChangeMode?: (oldMode: StickyBoxMode, newMode: StickyBoxMode) => void; + } +} + +declare const ReactStickyBox: React.ComponentClass; + +export = ReactStickyBox; diff --git a/types/react-sticky-box/react-sticky-box-tests.tsx b/types/react-sticky-box/react-sticky-box-tests.tsx new file mode 100644 index 0000000000..a2aa8fd2aa --- /dev/null +++ b/types/react-sticky-box/react-sticky-box-tests.tsx @@ -0,0 +1,19 @@ +import ReactStickyBox, { StickyBoxMode } from "react-sticky-box"; +import * as React from "react"; + +const ReactStickyBoxRequiredOptions: JSX.Element = ( + +); + +const changeHandler = (oldMode: StickyBoxMode, newMode: StickyBoxMode) => { + console.log(`Changing from ${oldMode} to ${newMode}`); +}; + +const ReactStickyBoxAllOptions: JSX.Element = ( + +); diff --git a/types/react-sticky-box/tsconfig.json b/types/react-sticky-box/tsconfig.json new file mode 100644 index 0000000000..ca9381b1af --- /dev/null +++ b/types/react-sticky-box/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "react-sticky-box-tests.tsx" + ] +} diff --git a/types/react-sticky-box/tslint.json b/types/react-sticky-box/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-sticky-box/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }