chore(types): upgrade to typescript 3.7.5 (#855)

This commit is contained in:
Joel Einbinder 2020-02-05 16:53:36 -08:00 committed by GitHub
parent 4aa155ede1
commit 4be39f8af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 15 additions and 15 deletions

View File

@ -72,7 +72,7 @@
"pixelmatch": "^4.0.2",
"text-diff": "^1.0.1",
"ts-loader": "^6.1.2",
"typescript": "3.6.3",
"typescript": "^3.7.5",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9"
},

View File

@ -93,8 +93,8 @@ export class CRBrowser extends platform.EventEmitter implements Browser {
close: async (): Promise<void> => {
assert(contextId, 'Non-incognito profiles cannot be closed!');
await this._client.send('Target.disposeBrowserContext', { browserContextId: contextId! });
this._contexts.delete(contextId!);
await this._client.send('Target.disposeBrowserContext', { browserContextId: contextId });
this._contexts.delete(contextId);
},
cookies: async (): Promise<network.NetworkCookie[]> => {
@ -288,7 +288,7 @@ export class CRBrowser extends platform.EventEmitter implements Browser {
assert(this._tracingClient, 'Tracing was not started.');
let fulfill: (buffer: platform.BufferType) => void;
const contentPromise = new Promise<platform.BufferType>(x => fulfill = x);
this._tracingClient!.once('Tracing.tracingComplete', event => {
this._tracingClient.once('Tracing.tracingComplete', event => {
readProtocolStream(this._tracingClient!, event.stream!, this._tracingPath).then(fulfill);
});
await this._tracingClient!.send('Tracing.end');

View File

@ -129,7 +129,7 @@ class JSCoverage {
this._client.send('Profiler.stopPreciseCoverage'),
this._client.send('Profiler.disable'),
this._client.send('Debugger.disable'),
]);
] as const);
helper.removeEventListeners(this._eventListeners);
const coverage = [];

View File

@ -91,7 +91,7 @@ export class CRPage implements PageDelegate {
const [,{frameTree}] = await Promise.all([
this._client.send('Page.enable'),
this._client.send('Page.getFrameTree'),
]);
] as const);
this._handleFrameTree(frameTree);
const promises: Promise<any>[] = [
this._client.send('Log.enable', {}),

View File

@ -237,7 +237,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
const [quads, metrics] = await Promise.all([
this._page._delegate.getContentQuads(this),
this._page._delegate.layoutViewport(),
]);
] as const);
if (!quads || !quads.length)
throw new Error('Node is either not visible or not an HTMLElement');

View File

@ -188,8 +188,8 @@ export class FFBrowser extends platform.EventEmitter implements Browser {
close: async (): Promise<void> => {
assert(browserContextId, 'Non-incognito profiles cannot be closed!');
await this._connection.send('Target.removeBrowserContext', { browserContextId: browserContextId! });
this._contexts.delete(browserContextId!);
await this._connection.send('Target.removeBrowserContext', { browserContextId });
this._contexts.delete(browserContextId);
},
cookies: async (): Promise<network.NetworkCookie[]> => {

View File

@ -783,7 +783,7 @@ export class Frame {
const context = await this._context('utility');
const maybeHandle = await context._$(selector);
assert(maybeHandle, 'No node found for selector: ' + selector);
handle = maybeHandle!;
handle = maybeHandle;
}
return handle;
}

View File

@ -219,7 +219,7 @@ class Helper {
}
}
export function assert(value: any, message?: string) {
export function assert(value: any, message?: string): asserts value {
if (!value)
throw new Error(message);
}

View File

@ -201,20 +201,20 @@ export class Request {
assert(this._delegate, 'Request Interception is not enabled!');
assert(!this._interceptionHandled, 'Request is already handled!');
this._interceptionHandled = true;
await this._delegate!.abort(errorCode);
await this._delegate.abort(errorCode);
}
async fulfill(response: { status: number; headers: Headers; contentType: string; body: (string | platform.BufferType); }) { // Mocking responses for dataURL requests is not currently supported.
assert(this._delegate, 'Request Interception is not enabled!');
assert(!this._interceptionHandled, 'Request is already handled!');
this._interceptionHandled = true;
await this._delegate!.fulfill(response);
await this._delegate.fulfill(response);
}
async continue(overrides: { method?: string; headers?: Headers; postData?: string } = {}) {
assert(this._delegate, 'Request Interception is not enabled!');
assert(!this._interceptionHandled, 'Request is already handled!');
await this._delegate!.continue(overrides);
await this._delegate.continue(overrides);
}
_isIntercepted(): boolean {

View File

@ -112,7 +112,7 @@ export class WKPage implements PageDelegate {
// Page agent must be enabled before Runtime.
session.send('Page.enable'),
session.send('Page.getResourceTree'),
]);
] as const);
resourceTreeHandler(frameTree);
const promises : Promise<any>[] = [
// Resource tree should be received before first execution context.