I'm just learning Typescript. I'm writing an Angular 2 app with typescript 2, using SystemJS 0.15.31 as my module loader.
I'd like to define app-wide constants. in one file, and import it in my components as needed. This is what I have:
root/systemjs.config.js
System.config({
map:{
'app': 'dist',
'config': 'dist/config',
...
}
});
root/dev/config.ts
export module Config {
var version:string = '1';
}
root/dev/app/app.component.ts
import {Config} from 'config';
...
export class AppComponent {
...
version = Config.version;
}
After transpilation to Javascript, the .ts files are put in dist/. However, the typescript compiler shows this error on the first line of app.component.ts and in the browser, AppComponent doesn't see Config.version
error TS2307: Cannot find module 'config'.
What's the problem with my syntax?