jquery - Value of type “jQueryStatic<TElement extends Node>” is not callable -
issue: visual studio intellisense yells @ $
: value of type “jquerystatic<telement extends node>” not callable
example code (all instances of $
, really):
const emaildiv = $("<div>", { "class": "email-item" }); $(containerid).append(emaildiv);
setup:
- visual studio 2017
- asp.net core web application
- definitelytyped jquery 3.2.1
- jquery 3.2.1
- ts 2.3
- resharper 2017.1.3
tsconfig.ts:
{ "compileroptions": { "lib": [ "es2015", "es2015.iterable", "dom" ], "noimplicitany": true, "noemitonerror": true, "removecomments": false, "sourcemap": true, "target": "es5" }, "files": [ // bunch of local files... ], "compileonsave": true }
.csproj:
<propertygroup> <targetframework>netcoreapp2.0</targetframework> <typescripttoolsversion>2.3</typescripttoolsversion> </propertygroup> <itemgroup> <packagereference include="microsoft.aspnetcore.all" version="2.0.0" /> <packagereference include="microsoft.visualstudio.web.codegeneration.design" version="2.0.0" /> </itemgroup> <itemgroup> <dotnetclitoolreference include="microsoft.visualstudio.web.codegeneration.tools" version="2.0.0" /> </itemgroup> <itemgroup> <!-- other .ts files --> <typescriptcompile include="scripts\scripts.ts" /> </itemgroup> <itemgroup> <folder include="wwwroot\scripts\" /> </itemgroup> </project>
everything builds , works fine. has clue?
value of type “jquerystatic” not callable
caused compatability issues between type definiton , typescript compiler version.
fix
upgrade typescript latest (2.5.2
) , make sure jquery.d.ts
(or @types/jquery
) date.
Comments
Post a Comment