TypeScript Interface Checking issue

Just a report of a wrong error detection:

I am on Resharper 2017.2 EAP 12 and have the following issue in my Angular 1.6 app: (TypeScript 2.1, VS2015)

 

My Code: 

export class ActionController implements ng.IController { // ReSharper shows Error on ng.IController: Controller declares Interface but does not implement it

    $onChanges(onChangesObj: angular.IOnChangesObject): void {...} // ERROR

}

However when I use 'Add missing overload signature' fix on the error, two implementations get inserted:

$onChanges(onChangesObj: angular.IOnChangesObject): void; // The same as I used!
$onChanges(onChangesObj: any): void;

 

 

As a workaround I changed my signature to the second interface definition and the error went away.

 

Another issue: I removed my $onChanges method and used the 'Generate \ overriding members' -> $onChanges action. 

Then Reshaper throws an Exception: "An item with the same key has already been added". I have submitted this exception.

0
2 comments

Hello Chris!

 

Sorry for delay in responding.

Could you please provide some sample solution in which the issue is reproduced. Also some screenshots illustrating the issue wil be appreciated.

Thanks in advance!

0
Avatar
Permanently deleted user

Hello Angelina!

 

I just found out the problem is limited to my own non consistent usage on angular namespaces.

If I replace 'angular.IOnChangesObject' with 'ng.IOnChangesObject' the error goes away.

 

However, I thought ng and angular namespaces were equivalent. 

 

 

I have the VS solution available here if you need it:

https://1drv.ms/u/s!AgW0waW4FHmZg9JO7RimHtflYOAzMg

 

all the best, Chris

0

Please sign in to leave a comment.