Typescript, Angular CLI, NPM, VS Code: Property <property> does not exist on type 'jQueryStatic<HTMLElement>' -


scenario

i using angular, angular cli, npm , typescript in single page app.

in 1 of components, have need use jquery initialize jquery plugin. in case, plugin backstretch, not relevant problem described below same jquery plugin.

and yes, know of say, angular , jquery - not best idea. fact reusable jquery plugins still useful in angular app.

problem

despite fact when writing code in vs code ide, intellisense drop-down shows properties of both jquery , backstretch , there seems no error whatsoever, problem appear when running "ng serve", when typescript compiles javascript.

the error in console is:

error in c:/wamp/www/paperbackcomingsoon/angular/my-app/src/app/app.component.ts (20,7): property 'backstretch' not exist on type 'jquerystatic'.

in screenshot below can see error, jsconfig.json file , installed type definitions both jquery , backstretch.

enter image description here

while compiler seems find jquery, has issues finding backstretch strange reason. below can see actual type definition backstretch.

enter image description here

questions

what missing? have idea wrong here? possible type definition file backstretch plugin not right version actual jquery backstretch plugin?

since of course using typescript, want jquery plugins have typing files available types typed. see no reason why not use feature if typings jquery plugin indeed available me. know fix compiling problem defining typing on own , making jquery plugins of type "any", not want , not seem right. want leverage typing files @ disposal. don't see reason why not, because compiler not seem find defined property.


possible reason

my best bet has difference in ts versions installed globally on system versus typescript in vs code ide, because when checking ts version in vscode in status bar @ right bottom of ide says 2.4.2.

enter image description here

but if run "tsc -v" in console, gives me 1.0.3.0 (mind i've been using ts before, visual studio). after run "npm install -g typescript@2.4.2, not change anything.

enter image description here

any idea, anyone?

update npm

npm install npm@latest -g 

update typescript

npm -g upgrade typescript 

or

npm install typescript@latest -g 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -