remove node from tsconfig types and use import statement in tests

This commit is contained in:
Peter van der Woude
2018-06-23 17:09:03 +10:00
parent d80f628153
commit 5ce60d33ad
3 changed files with 10 additions and 11 deletions
+4 -5
View File
@@ -1,14 +1,13 @@
// Type definitions for jotform-css.js v1.0.1
// Project: https://github.com/jotform/css.js
// Definitions by: My Self <https://github.com/pandawood>
// Definitions by: Peter van der Woude <https://github.com/pandawood>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* 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 {
+5 -5
View File
@@ -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 (<any>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 }")
+1 -1
View File
@@ -12,7 +12,7 @@
"typeRoots": [
"../"
],
"types": ["node"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},