0
votes

Recently updated to Typescript 2.6.1 (from 1.8.2) and installed the relevant definition files via 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'.

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. VS2015's intellisense shows the error message

Types of property 'find' are incompatible. Type '{ (selector: string): IAugmentedJQuery; (element: any): IAugmentedJQuery; (obj: JQuery): IAugment...' is not assignable to type '{ (selector: string): this; (element: any): this; (obj: JQuery): this; (selector: string): JQuery...'.

I double checked JQuery interface and the types clearly match. Any ideas why I am getting the error.

1
Angularjs typings defines IAugmentedJQuery that extends JQuery interface. But it seems to be picking up the JQuery interface definition from jqlite.d.ts. I edited JQuery interface in jqlite.d.ts to change the declarations for inheritedData() and find() to return JQuery instead of "this" and added isolateScope<T extends IScope>(): T; to IAugmentedJQuery and the errors have disappeared. I am not 100% confident this is the correct solution unless someone tells me the angularjs definition file is incorrect/incomplete.Raghu

1 Answers

0
votes

I was incorrectly using the deprecated angularjs. I should have paid more attention to the output from 'npm install'. After removing angularjs and installing angular, I do not see the error any more.