From 5ce60d33addd1ab2787aa531e792c629e53f8ff7 Mon Sep 17 00:00:00 2001 From: Peter van der Woude Date: Sat, 23 Jun 2018 17:09:03 +1000 Subject: [PATCH] remove node from tsconfig types and use import statement in tests --- types/jotform-css.js/index.d.ts | 9 ++++----- types/jotform-css.js/jotform-css.js-tests.ts | 10 +++++----- types/jotform-css.js/tsconfig.json | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/types/jotform-css.js/index.d.ts b/types/jotform-css.js/index.d.ts index e21dae2eb9..cb6c62b6c0 100644 --- a/types/jotform-css.js/index.d.ts +++ b/types/jotform-css.js/index.d.ts @@ -1,14 +1,13 @@ // Type definitions for jotform-css.js v1.0.1 // Project: https://github.com/jotform/css.js -// Definitions by: My Self +// Definitions by: Peter van der Woude // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// /** - * intermediate object - needed as a result of the way the libary doesn't explicitly export anything + * Thid doesn't get used in the way I intended */ -export interface CssJsGlobal { - cssjs() : CssJs -} +export function cssjs() : CssJs export interface CssJs { diff --git a/types/jotform-css.js/jotform-css.js-tests.ts b/types/jotform-css.js/jotform-css.js-tests.ts index 80f4fd5b54..ad3e45e100 100644 --- a/types/jotform-css.js/jotform-css.js-tests.ts +++ b/types/jotform-css.js/jotform-css.js-tests.ts @@ -1,12 +1,12 @@ -let cssjsGlobal = require("../../jotform-css.js") +import cssjsGlobal = require("../jotform-css.js") import { CssJs } from "./index" // not all interface methods tested here, below is a sample of code that I've actually used class TestParser { - public parse(): string { - const parser = new cssjsGlobal.cssjs() as CssJs + public parse(cssString: string): string { + const parser = new (cssjsGlobal).cssjs() as CssJs - let parsed = parser.parseCSS(".foo { background-color: red }") + let parsed = parser.parseCSS(cssString) parsed = parser.applyNamespacing(parsed, "#id1") let css = parser.getCSSForEditor(parsed) return css @@ -14,4 +14,4 @@ class TestParser { } let parsingTest = new TestParser() -let css = parsingTest.parse() +let css = parsingTest.parse(".foo { background-color: red }") diff --git a/types/jotform-css.js/tsconfig.json b/types/jotform-css.js/tsconfig.json index 484cc299b5..2e6cc5a4f5 100644 --- a/types/jotform-css.js/tsconfig.json +++ b/types/jotform-css.js/tsconfig.json @@ -12,7 +12,7 @@ "typeRoots": [ "../" ], - "types": ["node"], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true },