style(aio): enforce strict TypeScript checks (#21342)
Closes #20646 PR Close #21342
This commit is contained in:

committed by
Alex Eagle

parent
246de65140
commit
c5c6d84fe6
@ -38,7 +38,7 @@ export class TestDocViewerComponent extends DocViewerComponent {
|
||||
template: '<aio-doc-viewer [doc]="currentDoc">Test Component</aio-doc-viewer>',
|
||||
})
|
||||
export class TestParentComponent {
|
||||
currentDoc: DocumentContents;
|
||||
currentDoc?: DocumentContents|null;
|
||||
@ViewChild(DocViewerComponent) docViewer: DocViewerComponent;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ export class TestModule { }
|
||||
|
||||
export class ObservableWithSubscriptionSpies<T = void> extends Observable<T> {
|
||||
unsubscribeSpies: jasmine.Spy[] = [];
|
||||
subscribeSpy = spyOn(this, 'subscribe').and.callFake((...args) => {
|
||||
subscribeSpy = spyOn(this, 'subscribe').and.callFake((...args: any[]) => {
|
||||
const subscription = super.subscribe(...args);
|
||||
const unsubscribeSpy = spyOn(subscription, 'unsubscribe').and.callThrough();
|
||||
this.unsubscribeSpies.push(unsubscribeSpy);
|
||||
|
@ -113,7 +113,7 @@ export class MockNgModuleFactoryLoader implements NgModuleFactoryLoader {
|
||||
this.loadedPaths.push(path);
|
||||
|
||||
const platformRef = getPlatform();
|
||||
const compilerFactory = platformRef.injector.get(CompilerFactory) as CompilerFactory;
|
||||
const compilerFactory = platformRef!.injector.get(CompilerFactory) as CompilerFactory;
|
||||
const compiler = compilerFactory.createCompiler([]);
|
||||
|
||||
return compiler.compileModuleAsync(MockEmbeddedModule);
|
||||
|
@ -4,7 +4,7 @@ export class MockLocationService {
|
||||
urlSubject = new BehaviorSubject<string>(this.initialUrl);
|
||||
currentUrl = this.urlSubject.asObservable().map(url => this.stripSlashes(url));
|
||||
// strip off query and hash
|
||||
currentPath = this.currentUrl.map(url => url.match(/[^?#]*/)[0]);
|
||||
currentPath = this.currentUrl.map(url => url.match(/[^?#]*/)![0]);
|
||||
search = jasmine.createSpy('search').and.returnValue({});
|
||||
setSearch = jasmine.createSpy('setSearch');
|
||||
go = jasmine.createSpy('Location.go').and
|
||||
@ -14,7 +14,7 @@ export class MockLocationService {
|
||||
handleAnchorClick = jasmine.createSpy('Location.handleAnchorClick')
|
||||
.and.returnValue(false); // prevent click from causing a browser navigation
|
||||
|
||||
constructor(private initialUrl) {}
|
||||
constructor(private initialUrl: string) {}
|
||||
|
||||
private stripSlashes(url: string) {
|
||||
return url.replace(/^\/+/, '').replace(/\/+(\?|#|$)/, '$1');
|
||||
|
@ -3,21 +3,21 @@ import { Injectable } from '@angular/core';
|
||||
@Injectable()
|
||||
export class MockLogger {
|
||||
|
||||
output = {
|
||||
output: { log: any[], error: any[], warn: any[] } = {
|
||||
log: [],
|
||||
error: [],
|
||||
warn: []
|
||||
};
|
||||
|
||||
log(value: any, ...rest) {
|
||||
log(value: any, ...rest: any[]) {
|
||||
this.output.log.push([value, ...rest]);
|
||||
}
|
||||
|
||||
error(value: any, ...rest) {
|
||||
error(value: any, ...rest: any[]) {
|
||||
this.output.error.push([value, ...rest]);
|
||||
}
|
||||
|
||||
warn(value: any, ...rest) {
|
||||
warn(value: any, ...rest: any[]) {
|
||||
this.output.warn.push([value, ...rest]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user