I am migrating a JavaScript project to TypeScript. The existing JavaScript uses requirejs for module loading, and I would like to do the same in TypeScript.
I have one module that is throwing "cannot find module" errors from its import statements when I compile. I have the correct <reference/> tags, and the references modules will work at runtime as expected. However, I would like to get these erroneous compiler errors out of my Error List window.
Here is the basic file structure of this module and its references:
root/
helper.ts
ui/
uiModule.ts //This module is throwing the error
panels/
panel1.ts //The import of this module throws the error
The top of uiModule looks like this:
///<reference path="../helper.ts"/>
///<reference path="panels/panel1.ts"/>
import helper = require("Helper");
import panel1 = require("Panel1");
All of the modules are setup as single classes, like this:
//references and imports...
class MyClass {
//Methods...
}
export = MyClass;
All filenames and import aliases start with lowercase; all class names start with uppercase.
The "cannot find module" errors seem to only be happening when one module references another in a deeper folder. If I change the import statement to `require("Panels/panel1"), the compiler error goes away, but it fails at runtime.
How can I correctly make this error stop showing up? I have a config file for requirejs. Can I point the language service to that file to resolve module references? I would really like to decouple references from file paths at design time as much as possible.