TypeScript definition issue

Completed

I have loaded the following npm packages: 

  • "@types/angular-translate": "2.4.35",
  • "@types/angular": "1.5.X",

 

In my code I call: 

  • $filter('date')(input, format)

I get the error: 'Supplied parameters do not match any signature of call target: parameter type mismatch. Parameter 'name' should have type assignable to '"translate"', but it has '"date"'

 

I looked up the lines in the definition of angular-translate and found:

interfaceIFilterService {
(name: 'translate'): {
(translationId: string, interpolateParams?: any, interpolation?: string): string;
};
}
 
In angular core definition it says:
 
interfaceIFilterService {
(name: 'filter'): IFilterFilter;
(name: 'currency'): IFilterCurrency;
(name: 'number'): IFilterNumber;
(name: 'date'): IFilterDate;
(name: 'json'): IFilterJson;
(name: 'lowercase'): IFilterLowercase;
(name: 'uppercase'): IFilterUppercase;
(name: 'limitTo'): IFilterLimitTo;
(name: 'orderBy'): IFilterOrderBy;
<T>(name: string): T;
}
 
It seems the translate interface overwrites the definition in the angular core module instead of combining these two together.
 
I am refering to delcaration merging acc to this doc: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
 
My environment: VS2015, ReSharper 2017.1.3 with Typescript Level 2.1.
 
The tsc compiler (2.1.15) is not showing any errors.
 
 
Thank you very much for clearing up whats correct here!
2 comments
Comment actions Permalink

Hello Chris!

 

Thank you for contacting  us.

Please try the latest ReSharper 2017.2 EAP version - https://www.jetbrains.com/resharper/eap/ and check if the issue is still reproduced.

Thank you.

0
Comment actions Permalink

Thank you very much Angelina,

 

This issue is fixed in EAP

0

Please sign in to leave a comment.