refactor(service-worker): ensure compatibility with noImplicitOverride (#42512)

Adds the `override` keyword to the `service-worker` sources to ensure
compatibility with `noImplicitOverride`.

PR Close #42512
This commit is contained in:
Paul Gschwendtner 2021-06-07 21:05:03 +02:00 committed by Andrew Kushnir
parent 01e869a45b
commit 388496c17d
2 changed files with 7 additions and 8 deletions

View File

@ -99,7 +99,6 @@ export class MockHeaders implements Headers {
export class MockRequest extends MockBody implements Request {
readonly isHistoryNavigation: boolean = false;
readonly isReloadNavigation: boolean = false;
readonly body!: ReadableStream;
readonly cache: RequestCache = 'default';
readonly credentials: RequestCredentials = 'omit';
readonly destination: RequestDestination = 'document';

View File

@ -71,7 +71,7 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
},
} as any;
get time() {
override get time() {
return this.mockTime;
}
@ -84,7 +84,7 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
fired: boolean,
}[] = [];
parseUrl = parseUrl;
override parseUrl = parseUrl;
constructor(private server: MockServerState, caches: MockCacheStorage, scopeUrl: string) {
super(scopeUrl, caches);
@ -156,15 +156,15 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
this.eventHandlers.delete(type);
}
newRequest(url: string, init: Object = {}): Request {
override newRequest(url: string, init: Object = {}): Request {
return new MockRequest(normalizeUrl(url, this.scopeUrl), init);
}
newResponse(body: string, init: Object = {}): Response {
override newResponse(body: string, init: Object = {}): Response {
return new MockResponse(body, init);
}
newHeaders(headers: {[name: string]: string}): Headers {
override newHeaders(headers: {[name: string]: string}): Headers {
return Object.keys(headers).reduce((mock, name) => {
mock.set(name, headers[name]);
return mock;
@ -227,7 +227,7 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
return event.ready;
}
timeout(ms: number): Promise<void> {
override timeout(ms: number): Promise<void> {
const promise = new Promise<void>(resolve => {
this.timers.push({
at: this.mockTime + ms,
@ -254,7 +254,7 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
});
}
isClient(obj: any): obj is Client {
override isClient(obj: any): obj is Client {
return obj instanceof MockClient;
}
}