diff --git a/jsesc/jsesc-tests.ts b/jsesc/jsesc-tests.ts new file mode 100644 index 0000000000..355b2a7988 --- /dev/null +++ b/jsesc/jsesc-tests.ts @@ -0,0 +1,45 @@ +/// + +import jsesc = require('jsesc'); +import Opts = jsesc.Opts; + +// ---- ---- ---- ---- ---- ---- ---- + +var num: number; +var str: string; +var bool: boolean; +var opts: Opts; +var opts: Opts; + +// ---- ---- ---- ---- ---- ---- ---- + +str = jsesc.version; + +// ---- ---- ---- ---- ---- ---- ---- + +opts = { + quotes: str +}; +opts = { + wrap: bool +}; +opts = { + es6: bool +}; +opts = { + escapeEverything: bool +}; +opts = { + compact: bool +}; +opts = { + indent: str +}; +opts = { + json: bool +}; + +// ---- ---- ---- ---- ---- ---- ---- + +str = jsesc(str); +str = jsesc(str, opts); diff --git a/jsesc/jsesc.d.ts b/jsesc/jsesc.d.ts new file mode 100644 index 0000000000..76b40cf455 --- /dev/null +++ b/jsesc/jsesc.d.ts @@ -0,0 +1,25 @@ +// Type definitions for jsesc 0.4.3 +// Project: https://github.com/mathiasbynens/jsesc +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'jsesc' { + + function jsesc(str: string, opts?: any): string; + + module jsesc { + var version: string; + + interface Opts { + quotes?: string; + wrap?: boolean; + es6?: boolean; + escapeEverything?: boolean; + compact?: boolean; + indent?: string; + json?: boolean; + } + } + + export = jsesc; +}