I have created a TypeScript class file with the following code:
class SampleClass {
public load(): void {
console.log('loaded');
}
}
Now, I also have another TypeScript file which contains functions that need to utilize this class:
// declaration of SomeClass
declare var SampleClass;
function useSampleClass() {
const instance = new SampleClass();
instance.load();
}
When working in Visual Studio 2019, I encounter an issue where it identifies a duplicate declaration for SomeClass (seen at the declare var SampleClass
line). Although the .js file still gets generated, there is an error present.
Considering the problem of duplicate declarations, how can I instruct Visual Studio to compile the .ts files independently from one another?