问题:
Visual Studio IntelliSense 在 $
处大喊: Value of type “jQueryStatic<TElement extends Node>” is not callable
示例代码($
的所有实例,真的):
const emaildiv = $("<div>", { "class": "email-item" });
$(containerid).append(emaildiv);
设置:
- Visual Studio 2017
- ASP.NET 核心 Web 应用程序
- 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": [
// a 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>
一切都构建并运行良好。有人知道吗?
最佳答案
事实证明,问题又出在 Resharper 上 (Value of type "JqueryStatic" is not callable)。这是我所做的一切的列表:
- 根据 basarat 更新 TypeScript 和 jquery.d.ts的回答
- 将 Resharper 更新到 2017.2(即最新版本)
- ReSharper → 选项 → 常规 → 清理缓存 ( ReSharper TypeScript seems to be not working at all in my VS 2015 installation )
- ReSharper → 选项 → 代码编辑 → TypeScript → 检查 → TypeScript 语言级别 - 最新可用
- 重新启动 Visual Studio
关于jquery - 类型 “jQueryStatic<TElement extends Node>” 的值不可调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46208434/