How do I create node modules in typescript to be imported in other typescript files? I have searched and searched but cannot find how to do this properly.
I want to create a typescript module that exports some functions that I can import using require into my app.ts. I am using 'typescript-require'. Here is what I am doing (simplified):
app.ts
require('typescript-require');
import config = require('./config');
console.log(config.GetDefaultConfiguration());
config.ts
module config {
var defaultConfig = "default configuration";
export function GetDefaultConfiguration() {
return defaultConfig;
}
}
config.d.ts
declare module config {
}
But I get "TypeError: Object # has no method 'GetDefaultConfiguration'".
What am I missing?