From 2c708fc0a390bb7470f1857247d492c25fddfc58 Mon Sep 17 00:00:00 2001 From: Zhang Yi Jiang Date: Thu, 14 Feb 2019 13:12:31 +0800 Subject: [PATCH 1/2] Add no-scroll typing --- types/no-scroll/index.d.ts | 13 +++++++++++++ types/no-scroll/no-scroll-tests.ts | 5 +++++ types/no-scroll/tsconfig.json | 23 +++++++++++++++++++++++ types/no-scroll/tslint.json | 1 + 4 files changed, 42 insertions(+) create mode 100644 types/no-scroll/index.d.ts create mode 100644 types/no-scroll/no-scroll-tests.ts create mode 100644 types/no-scroll/tsconfig.json create mode 100644 types/no-scroll/tslint.json diff --git a/types/no-scroll/index.d.ts b/types/no-scroll/index.d.ts new file mode 100644 index 0000000000..9a7dcaec58 --- /dev/null +++ b/types/no-scroll/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for no-scroll 2.1 +// Project: https://github.com/davidtheclark/no-scroll +// Definitions by: Zhang Yi Jiang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface NoScroll { + off(): void; + on(): void; + toggle(): void; +} + +declare const noScroll: NoScroll; +export = noScroll; diff --git a/types/no-scroll/no-scroll-tests.ts b/types/no-scroll/no-scroll-tests.ts new file mode 100644 index 0000000000..c33ebcf799 --- /dev/null +++ b/types/no-scroll/no-scroll-tests.ts @@ -0,0 +1,5 @@ +import * as noScroll from 'no-scroll'; + +noScroll.on(); +noScroll.off(); +noScroll.toggle(); diff --git a/types/no-scroll/tsconfig.json b/types/no-scroll/tsconfig.json new file mode 100644 index 0000000000..f3d27166a1 --- /dev/null +++ b/types/no-scroll/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "no-scroll-tests.ts" + ] +} diff --git a/types/no-scroll/tslint.json b/types/no-scroll/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/no-scroll/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6dbb5ecf755b62835e22e63f2b5374453525a537 Mon Sep 17 00:00:00 2001 From: Zhang Yi Jiang Date: Thu, 14 Feb 2019 13:27:57 +0800 Subject: [PATCH 2/2] Add global namespace export --- types/no-scroll/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/no-scroll/index.d.ts b/types/no-scroll/index.d.ts index 9a7dcaec58..b20b596a27 100644 --- a/types/no-scroll/index.d.ts +++ b/types/no-scroll/index.d.ts @@ -3,6 +3,9 @@ // Definitions by: Zhang Yi Jiang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Module is exported as global object outside of module loader environment +export as namespace noScroll; + interface NoScroll { off(): void; on(): void;