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
Post a Comment