test: make NgMatchers type-aware (#19904)

PR Close #19904
This commit is contained in:
George Kalpakas
2018-07-05 15:24:53 +03:00
committed by Miško Hevery
parent 00c110b055
commit 809e8f742e
9 changed files with 39 additions and 59 deletions

View File

@ -15,7 +15,7 @@ import {ɵgetDOM as getDOM} from '@angular/platform-browser';
/**
* Jasmine matchers that check Angular specific conditions.
*/
export interface NgMatchers extends jasmine.Matchers<any> {
export interface NgMatchers<T = any> extends jasmine.Matchers<T> {
/**
* Expect the value to be a `Promise`.
*
@ -82,7 +82,7 @@ export interface NgMatchers extends jasmine.Matchers<any> {
/**
* Invert the matchers.
*/
not: NgMatchers;
not: NgMatchers<T>;
}
const _global = <any>(typeof window === 'undefined' ? global : window);
@ -94,7 +94,7 @@ const _global = <any>(typeof window === 'undefined' ? global : window);
*
* {@example testing/ts/matchers.ts region='toHaveText'}
*/
export const expect: (actual: any) => NgMatchers = <any>_global.expect;
export const expect: <T = any>(actual: T) => NgMatchers<T> = _global.expect;
// Some Map polyfills don't polyfill Map.toString correctly, which