Is it possible to combine jspm with TypeScript and the TypeScript module system?
I couldn't find documentation or samples of this.
SystemJS has been added as a module kind for TypeScript, so you should be able to use SystemJS out of the box and compile with the module flag:
tsc --module system app.ts
This was added alongside the ES6 module importing syntax, so you should be able to use that style and have it compiled to what you need.
import * as $ from "jquery";
If you are using the SystemJS syntax, you can declare the parts you need like this:
systemjs.d.ts
interface System {
then: (cb: Function) => void;
}
interface SystemStatic {
import: (name: string) => System;
}
declare var System: SystemStatic;
export = System;
You should then be able to use it like this:
/// <reference path="jquery.d.ts" />
import System = require('systemjs');
System.import('jquery').then(($: JQueryStatic) => {
$('#id').html('Hello world');
});