fix: use null instead of undefined (#8463)

This commit is contained in:
jrandolf 2022-06-02 15:38:13 +02:00 committed by GitHub
parent dac3e65533
commit 2615c1c3d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,7 +123,7 @@ export class Target {
/** /**
* If the target is not of type `"page"` or `"background_page"`, returns `null`. * If the target is not of type `"page"` or `"background_page"`, returns `null`.
*/ */
async page(): Promise<Page | undefined> { async page(): Promise<Page | null> {
if (this._isPageTargetCallback(this._targetInfo) && !this._pagePromise) { if (this._isPageTargetCallback(this._targetInfo) && !this._pagePromise) {
this._pagePromise = this._sessionFactory().then((client) => this._pagePromise = this._sessionFactory().then((client) =>
Page.create( Page.create(
@ -135,7 +135,7 @@ export class Target {
) )
); );
} }
return this._pagePromise; return (await this._pagePromise) ?? null;
} }
/** /**