Is there any way to import some library-generated code which does not have export
vars? Which module
options should be set in tsconfig.json
file?
Documents
Environment
- typescript @2.3.2
- js-routes @1.3.3
Example
js-routes
generate a code like below based on routes.rb
:
/*
File generated by js-routes 1.3.3
Based on Rails routes of MyApplication
*/
(function() {
...
return root.Routes;
};
if (typeof define === "function" && define.amd) {
define([], function() {
return createGlobalJsRoutesObject();
});
} else {
createGlobalJsRoutesObject();
}
}).call(this);
If you import in 'module=es2015' style,
import { Routes } from '../path/to//generated/js_routes';
tsc
warns:
[ts] File '/path/to/client/generated/js_routes.js' is not a module.