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", "pixelmatch": "^4.0.2",
"text-diff": "^1.0.1", "text-diff": "^1.0.1",
"ts-loader": "^6.1.2", "ts-loader": "^6.1.2",
"typescript": "3.6.3", "typescript": "^3.7.5",
"webpack": "^4.41.0", "webpack": "^4.41.0",
"webpack-cli": "^3.3.9" "webpack-cli": "^3.3.9"
}, },

View file

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

View file

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

View file

@ -91,7 +91,7 @@ export class CRPage implements PageDelegate {
const [,{frameTree}] = await Promise.all([ const [,{frameTree}] = await Promise.all([
this._client.send('Page.enable'), this._client.send('Page.enable'),
this._client.send('Page.getFrameTree'), this._client.send('Page.getFrameTree'),
]); ] as const);
this._handleFrameTree(frameTree); this._handleFrameTree(frameTree);
const promises: Promise<any>[] = [ const promises: Promise<any>[] = [
this._client.send('Log.enable', {}), 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([ const [quads, metrics] = await Promise.all([
this._page._delegate.getContentQuads(this), this._page._delegate.getContentQuads(this),
this._page._delegate.layoutViewport(), this._page._delegate.layoutViewport(),
]); ] as const);
if (!quads || !quads.length) if (!quads || !quads.length)
throw new Error('Node is either not visible or not an HTMLElement'); 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> => { close: async (): Promise<void> => {
assert(browserContextId, 'Non-incognito profiles cannot be closed!'); assert(browserContextId, 'Non-incognito profiles cannot be closed!');
await this._connection.send('Target.removeBrowserContext', { browserContextId: browserContextId! }); await this._connection.send('Target.removeBrowserContext', { browserContextId });
this._contexts.delete(browserContextId!); this._contexts.delete(browserContextId);
}, },
cookies: async (): Promise<network.NetworkCookie[]> => { cookies: async (): Promise<network.NetworkCookie[]> => {

View file

@ -783,7 +783,7 @@ export class Frame {
const context = await this._context('utility'); const context = await this._context('utility');
const maybeHandle = await context._$(selector); const maybeHandle = await context._$(selector);
assert(maybeHandle, 'No node found for selector: ' + selector); assert(maybeHandle, 'No node found for selector: ' + selector);
handle = maybeHandle!; handle = maybeHandle;
} }
return handle; 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) if (!value)
throw new Error(message); throw new Error(message);
} }

View file

@ -201,20 +201,20 @@ export class Request {
assert(this._delegate, 'Request Interception is not enabled!'); assert(this._delegate, 'Request Interception is not enabled!');
assert(!this._interceptionHandled, 'Request is already handled!'); assert(!this._interceptionHandled, 'Request is already handled!');
this._interceptionHandled = true; 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. 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._delegate, 'Request Interception is not enabled!');
assert(!this._interceptionHandled, 'Request is already handled!'); assert(!this._interceptionHandled, 'Request is already handled!');
this._interceptionHandled = true; this._interceptionHandled = true;
await this._delegate!.fulfill(response); await this._delegate.fulfill(response);
} }
async continue(overrides: { method?: string; headers?: Headers; postData?: string } = {}) { async continue(overrides: { method?: string; headers?: Headers; postData?: string } = {}) {
assert(this._delegate, 'Request Interception is not enabled!'); assert(this._delegate, 'Request Interception is not enabled!');
assert(!this._interceptionHandled, 'Request is already handled!'); assert(!this._interceptionHandled, 'Request is already handled!');
await this._delegate!.continue(overrides); await this._delegate.continue(overrides);
} }
_isIntercepted(): boolean { _isIntercepted(): boolean {

View file

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