Dojo 1.8 already defines AMD modules. For example you can do things like this:
require(["dojo/_base/lang"], function (lang) {
var ab = lang.mixin({a: 1}, {b: 2});
});
But how to I avoid getting an error when I attempt to import this module?
import lang = module ("dojo/_base/lang");
Is is possible?
You will need a typescript definition file for lang. Assuming that
lang.d.tsexists in the same directory aslang.jsthis code:compiled with
generates
If you don’t want to have to match up the directory structures for whatever reason do this instead. Assuming
lang.d.tsis in in a subdirectory called3rdthat is a sibling oftest.ts.test.ts:
3rd/lang.d.ts:
generates the same as above.