Reputation: 10949
I'm new to TypeScript and I'm having a problem loading an es6 javascript module.
I have the following javascript file
//TemplateFactory.js
export class TemplateFactory{
static getTemplate(module){
}
}
and I created the following d.ts file
//TemplateFactory.d.ts
declare module "TemplateFactory" {
export class TemplateFactory {
static getTemplate(module);
}
}
However when I import the js module in another ts file I get this error:
File ....TemplateFactory .d.ts is not a module
What am I doing wrong? I'm using TypeScript 1.8
Upvotes: 1
Views: 3586
Reputation: 10949
I've managed to solve this. Here is the code that worked for me:
export declare class TemplateFactory {
static getTemplate(module: any): void;
}
Upvotes: 2
Reputation: 96
Try this ,
//TemplateFactory.d.ts
declare module TemplateFactory {
export class TemplateFactory {
static getTemplate(module);
}
}
Don't use quotes .
Upvotes: -1