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:
parent
01e869a45b
commit
388496c17d
|
@ -99,7 +99,6 @@ export class MockHeaders implements Headers {
|
||||||
export class MockRequest extends MockBody implements Request {
|
export class MockRequest extends MockBody implements Request {
|
||||||
readonly isHistoryNavigation: boolean = false;
|
readonly isHistoryNavigation: boolean = false;
|
||||||
readonly isReloadNavigation: boolean = false;
|
readonly isReloadNavigation: boolean = false;
|
||||||
readonly body!: ReadableStream;
|
|
||||||
readonly cache: RequestCache = 'default';
|
readonly cache: RequestCache = 'default';
|
||||||
readonly credentials: RequestCredentials = 'omit';
|
readonly credentials: RequestCredentials = 'omit';
|
||||||
readonly destination: RequestDestination = 'document';
|
readonly destination: RequestDestination = 'document';
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
|
||||||
},
|
},
|
||||||
} as any;
|
} as any;
|
||||||
|
|
||||||
get time() {
|
override get time() {
|
||||||
return this.mockTime;
|
return this.mockTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
|
||||||
fired: boolean,
|
fired: boolean,
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
|
||||||
parseUrl = parseUrl;
|
override parseUrl = parseUrl;
|
||||||
|
|
||||||
constructor(private server: MockServerState, caches: MockCacheStorage, scopeUrl: string) {
|
constructor(private server: MockServerState, caches: MockCacheStorage, scopeUrl: string) {
|
||||||
super(scopeUrl, caches);
|
super(scopeUrl, caches);
|
||||||
|
@ -156,15 +156,15 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
|
||||||
this.eventHandlers.delete(type);
|
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);
|
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);
|
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) => {
|
return Object.keys(headers).reduce((mock, name) => {
|
||||||
mock.set(name, headers[name]);
|
mock.set(name, headers[name]);
|
||||||
return mock;
|
return mock;
|
||||||
|
@ -227,7 +227,7 @@ export class SwTestHarnessImpl extends Adapter<MockCacheStorage> implements
|
||||||
return event.ready;
|
return event.ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout(ms: number): Promise<void> {
|
override timeout(ms: number): Promise<void> {
|
||||||
const promise = new Promise<void>(resolve => {
|
const promise = new Promise<void>(resolve => {
|
||||||
this.timers.push({
|
this.timers.push({
|
||||||
at: this.mockTime + ms,
|
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;
|
return obj instanceof MockClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue