You can use SystemJS to import the module into Javascript.
Assuming you have a module named app.ts that exports a variable named value .
app.ts:
export let value = 'ABCASF';
In the script tag, you can write:
System.import('app.js').then(function(appModule) { console.log(appModule.value); }, console.error.bind(console));
Keep in mind that the name of the module you must provide to System.import may differ depending on your setup.
TypeScript classes are passed into ES5 functions, so you can use them in javascript this way.
example.ts:
export class Example { constructor(public someValue: string, private someOtherValue: number) { } public method() { return this.someOtherValue; } }
And in the script tag as follows:
System.import('example.js').then(function(example) {
toskv source share