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" }