all.
I'm using require.js, and TypeScript in AMD mode, and I'm having trouble importing Bootstrap into my scripts. I've got import statements like this;
import $ = require('jquery');
import ko = require('knockout');
import bootstrap = require('bootstrap');
And it's converting it into this JavaScript;
define(["require", "exports", 'jquery', 'knockout'],
function(require, exports, $, ko) {
...
});
Notice that Bootstrap isn't in the list of required modules. That's because TypeScript is being 'clever', noting that I'm never referencing the Bootstrap import like this;
// this never appears in my code
bootstrap.blah()
And dropping the 'unused' bootstrap import. In normal cases, this is fine, but bootstrap actually extends jQuery, adding things like
// bootstrap adds jQuery plugins like modal;
$(selector).modal()
So by dropping the include, jQuery is no longer extended with modal() etc, and my code fails.
What I need is a way to tell TypeScript that it really does need to include the 'bootstrap'module in the list of required modules.
Any ideas?