i'm using browserify to import some nodejs modules. All working fine using this sintax:
$ = jQuery = require('jquery');
require('bootstrap');
require('angular');
require('ngRoute');
require('firebase');
require('angularfire');
Now i'm trying to convert that in typescript (using version 1.8) but i can't figure how to do it. I'm using tsify plugin from browserify
i've tried some sintax like
import * as jquery from "jquery";
import * as jQuery from "jquery";
import * as $ from "jquery";
or
declare var jQuery;
declare var $;
import * as jquery from "jquery";
$ = jQuery =jquery;
but it's not working!
To have 'jQuery' available globally in the browser you need to attach it to the windows object.
This works for me:
import * as $ from "jquery";
(<any>window).jQuery = $
import "bootstrap";
See this answer: Declare Typescript global variable as "module" type
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With