I had the same problem when writing my own DI system for AngularJs 1.3 and Typescript. To solve this problem, I wrote a decorator that takes a class that implements the following interface:
interface IFilter { filter(value?: any, ...args): any; }
and it registers a filter with the following code:
var filterFactory = (...args) => { var filterObject = new target(...args); if (typeof filterObject.filter === 'function') { return filterObject.filter.bind(filterObject); } console.warn('Invalid filter: filter() method not found for:', filterName) return function() { };
My library uses a custom version of the TypeScript compiler that can generate interface metadata that injector.resolveParamNames uses to create a classic array of constructors like this: ['$q', '$timeout', FilterFactory]
You can find my project here , and a sample filter here
source share