2016-08-01 5 views
1

저는 TypeScript를 처음 사용하며 es6 javascript 모듈을로드하는 데 문제가 있습니다. 나는 다른 TS 파일에 JS 모듈을 가져올 때TypeScript에서 클래스 내보내기 모듈 선언

은 내가 다음 d.ts이

//TemplateFactory.d.ts 
declare module "TemplateFactory" { 
    export class TemplateFactory { 
     static getTemplate(module); 
    } 
} 

파일 만든

//TemplateFactory.js 
export class TemplateFactory{ 
    static getTemplate(module){ 

    } 
} 

다음과 같은 자바 스크립트 파일이 그러나 나는이 오류가 발생합니다 :

File ....TemplateFactory .d.ts is not a module

내가 뭘 잘못하고 있니? 나는

//TemplateFactory.d.ts 

declare module TemplateFactory { 

    export class TemplateFactory { 
     static getTemplate(module); 
    } 
} 

따옴표를 사용하지 마십시오,이 시도 타이프 1.8

답변

1

나는 이것을 해결할 수있었습니다. 나를 위해 일한 코드는 다음과 같습니다.

export declare class TemplateFactory { 
    static getTemplate(module: any): void; 
} 
0

을 사용하고 있습니다.

+0

작동 했습니까? . – Gangz

+0

죄송합니다 .. 작동하지 않습니다. 해결책을 찾아 내 자신의 답변을 추가했습니다. –

관련 문제