简体   繁体   English

angularjs打字稿定义文件中的错误

[英]Error in angularjs typescript definition file

Recently updated to Typescript 2.6.1 (from 1.8.2) and installed the relevant definition files via npm install. 最近更新为Typescript 2.6.1(从1.8.2版开始),并通过npm install安装了相关的定义文件。 I was able to address lot of errors due to the migration but I still get one error 由于迁移,我能够解决很多错误,但是我仍然遇到一个错误

@types\\angularjs\\index.d.ts(1839,15): error TS2430: Build:Interface 'IAugmentedJQuery' incorrectly extends interface 'JQuery'. @types \\ angularjs \\ index.d.ts(1839,15):错误TS2430:Build:Interface'IAugmentedJQuery'错误地扩展了接口'JQuery'。

I had to downgrade the JQuery typings to 2.0.48, since I read on SO that the angular typings that augment JQuery typings haven't been updated. 我不得不将JQuery类型降级到2.0.48,因为我在SO上读到,增加JQuery类型的角类型尚未更新。 VS2015's intellisense shows the error message VS2015的intellisense显示错误消息

Types of property 'find' are incompatible. 属性“查找”的类型不兼容。 Type '{ (selector: string): IAugmentedJQuery; 类型'{(选择器:字符串):IAugmentedJQuery; (element: any): IAugmentedJQuery; (元素:任何):IAugmentedJQuery; (obj: JQuery): IAugment...' is not assignable to type '{ (selector: string): this; (obj:JQuery):IAugment ...'不能分配给类型'{(selector:string):this; (element: any): this; (元素:任何):此; (obj: JQuery): this; (obj:JQuery):这个; (selector: string): JQuery...'. (选择器:字符串):JQuery ...”。

I double checked JQuery interface and the types clearly match. 我仔细检查了JQuery接口,类型明确匹配。 Any ideas why I am getting the error. 任何想法为什么我得到错误。

I was incorrectly using the deprecated angularjs. 我不正确地使用了已弃用的angularjs。 I should have paid more attention to the output from 'npm install'. 我应该更加关注“ npm install”的输出。 After removing angularjs and installing angular, I do not see the error any more. 删除angularjs并安装angular之后,我再也看不到该错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM