Reputation: 719
I am using both dust.js
(specifically, dustjs-linkedin) and dustjs-helpers
in my TypeScript project. I got the typings for dustjs-linkedin off of definitelyTyped, but I am having trouble with the dustjs-helpers. Pretty much, I just want to declare a module called dustjs-helpers
and have it correctly export the dustjst-linkedin
module. That means that any time you call import helpers = require('dustjs-helpers');
you should be able to access all of the functions that regular dust uses by default.
Dust's typings file declares its module as following: declare module "dustjs-linkedin" { ... }
. I was hoping that I could do something like the following, but I get errors...
/// <reference path="../dustjs-linkedin/dustjs-linkedin.d.ts" />
declare module "dustjs-helpers" {
import dust = require("dustjs-linkedin")
export = dust;
}
Can anyone help me out?
Upvotes: 0
Views: 478
Reputation: 276239
A bit involved but I have verified that this works:
declare module "dustjs-helpers" {
import dust = require("dustjs-linkedin")
// Bring into a type
type Dust = typeof dust;
// Specify extensions
type Extensions = {
anotherFunc : Function;
}
// Combine types
type DustExtended = Dust & Extensions;
// Create var for export
var dustExtended: DustExtended;
// Export
export = dustExtended;
}
Upvotes: 3