What is the TypeScript way to load modules dynamically (the path to the module is known at runtime)? I tried this:
var x = "someplace" import a = module(x)
But it seems that the TypeScript compiler would like to see the path as a string in import / module at compile time:
$ tsc test.ts /tmp/test.ts(2,19): error TS1003: Identifier expected. /tmp/test.ts(2,20): error TS1005: ';' expected.
I know that I can, for example, use RequireJS directly (if I use the amd module format), but this does not seem right to me - this is a solution for one specific library.
source share