From 4ef49ba4807166742c2b5913cf96cb80da56b495 Mon Sep 17 00:00:00 2001 From: Oscar Busk Date: Thu, 28 Jun 2018 22:21:06 +0200 Subject: [PATCH] Simplify filterfunction using interface instead of silly type --- types/angular/angular-tests.ts | 2 +- types/angular/index.d.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 3e67c88e67..5d7dd7cbb8 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -220,7 +220,7 @@ mod.filter({ name1(foo: any) { return () => {}; }, name2: ['foo', (foo: any) => () => {}], }); -const customStatefulFilter: ng.FilterFunction<(s: string) => number> = (s) => 1; +const customStatefulFilter: ng.IFilterFunction = (s) => 1; mod.filter('name', () => customStatefulFilter); mod.filter('name', ['$scope', () => customStatefulFilter]); mod.filter({ diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 50d28a2dbb..c05ee388a8 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -250,8 +250,8 @@ declare namespace angular { */ factory(name: string, $getFn: Injectable): IModule; factory(object: {[name: string]: Injectable}): IModule; - filter(name: string, filterFactoryFunction: Injectable>): IModule; - filter(object: {[name: string]: Injectable>}): IModule; + filter(name: string, filterFactoryFunction: Injectable): IModule; + filter(object: {[name: string]: Injectable}): IModule; provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; provider(name: string, inlineAnnotatedConstructor: any[]): IModule; @@ -2238,12 +2238,12 @@ declare namespace angular { (obj: Object): string; } - type FilterFunction = { + interface IFilterFunction extends Function { /** * By default, filters are only run once the input value changes. By marking the filter as `$stateful`, the filter will be run on every `$digest` to update the output. **This is strongly discouraged.** * See https://docs.angularjs.org/guide/filter#stateful-filters */ - $stateful?: boolean - } & Filter; - type FilterFactory = (...I: any[]) => FilterFunction; + $stateful?: boolean; + } + type FilterFactory = (...I: any[]) => IFilterFunction; }