Can't add matcher to jasmine declaration

// /typings/globals/jasmine/index.d.ts declare namespace jasmine { ... interface Matchers { ... } } // /src/auth.http.spec.ts // расширяю декларацию declare namespace jasmine{ interface Matchers { toBeAnInstanceOf(expected: any): boolean; } } describe('AuthHttp', ()=> { beforeEach(() => { jasmine.addMatchers({ toBeAnInstanceOf: // тело проверки }); }); it('provides an instance of AuthHttp as Http', inject([Http], (http) => { expect(http).toBeAnInstanceOf(AuthHttp); // Property 'toBeAnInstanceOf' does not exist on type 'Matchers'. })); }); 

    1 answer 1

    I used this approach, borrowed from the angular2 code (for some reason they decided to remove NgMatchers from the library, I had to get out)

     interface NgMatchers extends jasmine.Matchers { toBeAnInstanceOf(expected: any): boolean; } declare function expect(actual: any): NgMatchers;