Jouery carousel method error in Angular2 / typescript

I installed jquery and imported it correctly.

Somewhere in my application, I have a line as shown below,

$('#myCarousel').carousel("next"); 

When I do npm start , it gives below error

The 'carousel' property does not exist in the 'jQuery' type.

in Typescript if do $('#myCarousel'). , ** it shows the corresponding ** intellisense , but this method is not specified.

If I comment on this line of error generation, do npm start everything, and if I uncomment this line and update it, it will work.

Typescript compilation property. How to solve it ????

0
source share
1 answer

After the Angular Final Release,

1) add the following npm packages

  npm install --save-dev @types/jquery npm install --save-dev @types/bootstrap 

2) in tsconfig.json add the following entries to the type array,

  "types": [ "jquery", "bootstrap", ] 

And now you are good to go.

-1
source

Source: https://habr.com/ru/post/1242071/


All Articles