From 7c2ccbf62fbe6c1c94d7947223b2ee6b80d98931 Mon Sep 17 00:00:00 2001 From: Andrei Horodinca Date: Mon, 5 Nov 2018 16:46:21 +0100 Subject: [PATCH] Add dom lib --- types/smooth-scroll/index.d.ts | 11 ++++++++--- types/smooth-scroll/test/smooth-scroll-global.test.ts | 2 +- types/smooth-scroll/test/smooth-scroll.test.ts | 2 +- types/smooth-scroll/tsconfig.json | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/types/smooth-scroll/index.d.ts b/types/smooth-scroll/index.d.ts index a5aa54fd24..9a0b86696f 100644 --- a/types/smooth-scroll/index.d.ts +++ b/types/smooth-scroll/index.d.ts @@ -32,7 +32,12 @@ declare namespace SmoothScroll { // Speed & Easing speed?: number; clip?: boolean; - offset?: number | ((anchor?: Node | number, toggle?: Node) => number); + offset?: + | number + | (( + anchor?: Element | number | null, + toggle?: Element | null + ) => number); easing?: Easing; customEasing?: (time: number) => number; @@ -53,8 +58,8 @@ declare class SmoothScroll { destroy(): void; animateScroll( - anchor: Node | number, - toggle?: Node, + anchor: Element | number | null, + toggle?: Element | null, options?: SmoothScroll.Options ): void; diff --git a/types/smooth-scroll/test/smooth-scroll-global.test.ts b/types/smooth-scroll/test/smooth-scroll-global.test.ts index b34568b993..e230635f9e 100644 --- a/types/smooth-scroll/test/smooth-scroll-global.test.ts +++ b/types/smooth-scroll/test/smooth-scroll-global.test.ts @@ -17,7 +17,7 @@ example1.destroy(); // Scrolling to an anchor const example2 = () => { const scroll = new SmoothScroll(); - const anchor: Node = document.querySelector("#bazinga"); + const anchor = document.querySelector("#bazinga"); scroll.animateScroll(anchor, null, { speed: 1000 }); }; diff --git a/types/smooth-scroll/test/smooth-scroll.test.ts b/types/smooth-scroll/test/smooth-scroll.test.ts index 7db0b4cc2c..894790f744 100644 --- a/types/smooth-scroll/test/smooth-scroll.test.ts +++ b/types/smooth-scroll/test/smooth-scroll.test.ts @@ -19,7 +19,7 @@ example1.destroy(); // Scrolling to an anchor const example2 = () => { const scroll = new SmoothScroll(); - const anchor: Node = document.querySelector("#bazinga"); + const anchor = document.querySelector("#bazinga"); scroll.animateScroll(anchor, null, { speed: 1000 }); }; diff --git a/types/smooth-scroll/tsconfig.json b/types/smooth-scroll/tsconfig.json index 7f7cf35c9f..8d1fa8372b 100644 --- a/types/smooth-scroll/tsconfig.json +++ b/types/smooth-scroll/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": ["es6", "dom"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true,