Typescript compiles fail with error "Duplicate Identifier"

Viewed 126

I have some problem with karma runner. When it compiles the source from .ts to .js files. I fact a problem that when I use 'declare' keyword to declare a class that is defined in another file, the error "Duplicate identifier" occurs. For instance:

file_1.ts:

class Test {...}

file_2.ts

declare var Test
class Something{
    value: Test
    constructor(){}
}

I research that we can use "reference path" to solve it, but, I use server-side render and include the resource per one file not all of them. So, I see that with this solution, when I compile the to js files, I assume that it will include all code of them and increase my file size. Could somebody help me :(? Please correct me if I'm wrong.

P/S: Sorry about my poor English.

0 Answers
Related