If I’m loading dojo from a CDN how do I import a module using TypeScript? The following code has no idea where to look for “dojo”:
import dojo = module("dojo");
Is there a way to tell TypeScript to look elsewhere? Is there something similar to dojoConfig packages in TypeScript?
If you are referencing Dojo from a CDN you don’t want to import it using the “external module” machinery because this expects modules in either a CommonJS or AMD format, and expects them to be on the file system. What you want to do is simply /// require a “typing” for Dojo (for example, see JQuery.d.ts that comes with TypeScript).
What this will do is tell the compiler that all the types in Dojo are available in the compilation. It’s up to you to ensure Dojo is included properly at runtime.
I am not sure whether a Dojo.d.ts file has already been created. There’s a repository with a bunch of them that should at least serve as a good example if you want to start adding the typings yourself.