Encountering an issue related to the import
and module
features in TypeScript version 2.4.1. The problem arises from having two separate files:
testAdd.ts:
module mymodule {
export class myClassAdd {
static add(left: number, right: number): number {
return left + right;
}
}
}
testCallAdd.ts:
//import 'someLibrary';
module mymodule {
export class myClassCallAdd {
static callAdd(): void {
let result: number = mymodule.myClassAdd.add(3, 4); //error here
}
}
}
Currently, the code compiles without any issues. However, upon attempting to import a library using the import
statement, errors start to occur. Uncommenting the import line in testCallAdd.ts
triggers an error stating that myClassAdd does not exist on type typeof mymodule.
The reason behind this error is unclear along with its solution. It appears that the import
statement interferes with the compiler's visibility of testAdd.ts
. Seeking guidance on resolving this issue and understanding the root cause.
This problem arose while working on an Angular website that functions properly but requires testing using Jasmine. Struggling to establish a setup enabling both the Angular framework and unit tests to access the shared codebase.