How to define a Module that is a function in Typescript -


i'm looking way write valid definition file debug

in js call:

var debug = require('debug')('http') 

then use like:

debug('my debug message'); 

i have no clue how define debug.d.ts support pattern. wellcome.

thanks

for use in typescript you'll have separate out call 2 parts so:

import debugmod = require('debug'); var debug = debugmod('http'); 

the definition file (debug.d.ts) this:

declare module "debug" {     function dbg(s:string):(s:string) => void;      export = dbg; } 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -