From da6e5dabc87b1590c9f4e90ec71a4871de164663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kr=C3=B3l?= Date: Fri, 20 Oct 2017 22:19:43 +0200 Subject: [PATCH] Add react-dnd-touch-backend types (#20770) * Add react-dnd-touch-backend types * CS fixes * Add dom lib --- types/react-dnd-touch-backend/index.d.ts | 12 ++++++++++ .../react-dnd-touch-backend-tests.ts | 7 ++++++ types/react-dnd-touch-backend/tsconfig.json | 24 +++++++++++++++++++ types/react-dnd-touch-backend/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/react-dnd-touch-backend/index.d.ts create mode 100644 types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts create mode 100644 types/react-dnd-touch-backend/tsconfig.json create mode 100644 types/react-dnd-touch-backend/tslint.json diff --git a/types/react-dnd-touch-backend/index.d.ts b/types/react-dnd-touch-backend/index.d.ts new file mode 100644 index 0000000000..91ea6ce999 --- /dev/null +++ b/types/react-dnd-touch-backend/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for react-dnd-touch-backend 0.3 +// Project: https://github.com/yahoo/react-dnd-touch-backend#readme +// Definitions by: Daniel Król +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as ReactDnd from "react-dnd"; + +export default function createTouchBackend(options: TouchBackendOptions): ReactDnd.Backend; + +export interface TouchBackendOptions { + enableMouseEvents?: boolean; +} diff --git a/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts b/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts new file mode 100644 index 0000000000..07994e71be --- /dev/null +++ b/types/react-dnd-touch-backend/react-dnd-touch-backend-tests.ts @@ -0,0 +1,7 @@ +import * as ReactDnd from "react-dnd"; +import TouchBackend from "react-dnd-touch-backend"; + +const component = () => null; + +const dndComponent = ReactDnd.DragDropContext(TouchBackend)(component); +const dndComponentMouseEvents = ReactDnd.DragDropContext(TouchBackend({enableMouseEvents: true}))(component); diff --git a/types/react-dnd-touch-backend/tsconfig.json b/types/react-dnd-touch-backend/tsconfig.json new file mode 100644 index 0000000000..926592e1c3 --- /dev/null +++ b/types/react-dnd-touch-backend/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-dnd-touch-backend-tests.ts" + ] +} diff --git a/types/react-dnd-touch-backend/tslint.json b/types/react-dnd-touch-backend/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-dnd-touch-backend/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }