Jquery – error TS2339: Property ‘modal’ does not exist on type ‘JQuery’

jquerymodal-dialogtypescript

I'm using Typescript with AngularJS.
I have a problem with modals using typed definition of jQuery library.
I get the following error: 'error TS2339: Property 'modal' does not exist on type 'JQuery'.'

Version: jQuery library, version 1.10.x / 2.0.x
Definitions: https://github.com/borisyankov/DefinitelyTyped

Code

$scope.delete = function (id) {
  Photo.get({id: id}, function(result) {
     $scope.photo = result;
     $('#deletePhotoConfirmation').modal('show');// error line 
  });
};

I'm referencing to jquery.d.ts in angular.d.ts

<reference path="../jquery/jquery.d.ts" />

and my global vendor reference file looks like:

<reference path='../vendor/types/angular/angular.d.ts' />
<reference path='../vendor/types/angular/angular-mocks.d.ts' />
<reference path='../vendor/types/jasmine/jasmine.d.ts' />

Best Answer

with newer versions of typescript (>v2 i believe):

npm install -D @types/bootstrap

Edit: As hughjdavey said in his comment, you also need the following import lines: import * as bootstrap from "bootstrap"; import * as $ from 'jquery';