Dynamically import module in TypeScript -
what typescript way of loading modules dynamically (path module known @ runtime)? tried one:
var x = "someplace" import = module(x)
but seems typescript compiler see path string in import/module @ compile time:
$ tsc test.ts /tmp/test.ts(2,19): error ts1003: identifier expected. /tmp/test.ts(2,20): error ts1005: ';' expected.
i know can example directly use requirejs (if use amd module format), doesn't feel right me - it's solution 1 particular library.
you need specify hard coded string. variables not work because mean code have exist outside define
call typescript generate you. file code has live "inside" define call upon javascript generation. :)
however if not use typescript amd feature , use requirejs.d.ts
Comments
Post a Comment