Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(types): upgrade to typescript 3.7.5 #855

Merged
merged 1 commit into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
6 changes: 3 additions & 3 deletions src/chromium/crBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]> => {
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/chromium/crCoverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
2 changes: 1 addition & 1 deletion src/chromium/crPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {}),
Expand Down
2 changes: 1 addition & 1 deletion src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
4 changes: 2 additions & 2 deletions src/firefox/ffBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]> => {
Expand Down
2 changes: 1 addition & 1 deletion src/frames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/server/webkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class WebKit implements BrowserType {
}

async launch(options?: LaunchOptions & { slowMo?: number }): Promise<WKBrowser> {
const { browserServer, transport } = await this._launchServer(options, 'local', null);
const { browserServer, transport } = await this._launchServer(options, 'local');
const browser = await WKBrowser.connect(transport!, options && options.slowMo);
// Hack: for typical launch scenario, ensure that close waits for actual process termination.
browser.close = () => browserServer.close();
Expand Down
2 changes: 1 addition & 1 deletion src/webkit/wkPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down