docs: fix some tsdoc warning messages (#7059)

This commit is contained in:
Ayman Azzam 2021-04-06 10:58:01 +02:00 committed by GitHub
parent 4426135692
commit 4152383c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 51 additions and 25 deletions

View File

@ -550,7 +550,9 @@ export class Browser extends EventEmitter {
return this._connection.send('Browser.getVersion'); return this._connection.send('Browser.getVersion');
} }
} }
/**
* @public
*/
export const enum BrowserContextEmittedEvents { export const enum BrowserContextEmittedEvents {
/** /**
* Emitted when the url of a target inside the browser context changes. * Emitted when the url of a target inside the browser context changes.
@ -604,6 +606,7 @@ export const enum BrowserContextEmittedEvents {
* // Dispose context once it's no longer needed. * // Dispose context once it's no longer needed.
* await context.close(); * await context.close();
* ``` * ```
* @public
*/ */
export class BrowserContext extends EventEmitter { export class BrowserContext extends EventEmitter {
private _connection: Connection; private _connection: Connection;

View File

@ -67,7 +67,7 @@ export class Connection extends EventEmitter {
} }
/** /**
* @param {string} sessionId * @param sessionId -
* @returns {?CDPSession} * @returns {?CDPSession}
*/ */
session(sessionId: string): CDPSession | null { session(sessionId: string): CDPSession | null {
@ -167,7 +167,7 @@ export class Connection extends EventEmitter {
} }
/** /**
* @param {Protocol.Target.TargetInfo} targetInfo * @param targetInfo -
* @returns {!Promise<!CDPSession>} * @returns {!Promise<!CDPSession>}
*/ */
async createSession( async createSession(

View File

@ -38,6 +38,7 @@ export interface ConsoleMessageLocation {
/** /**
* The supported types for console messages. * The supported types for console messages.
* @public
*/ */
export type ConsoleMessageType = export type ConsoleMessageType =
| 'log' | 'log'

View File

@ -1030,7 +1030,9 @@ const devices: Device[] = [
}, },
}, },
]; ];
/**
* @public
*/
export type DevicesMap = { export type DevicesMap = {
[name: string]: Device; [name: string]: Device;
}; };
@ -1038,5 +1040,7 @@ export type DevicesMap = {
const devicesMap: DevicesMap = {}; const devicesMap: DevicesMap = {};
for (const device of devices) devicesMap[device.name] = device; for (const device of devices) devicesMap[device.name] = device;
/**
* @public
*/
export { devicesMap }; export { devicesMap };

View File

@ -38,6 +38,7 @@ import { Protocol } from 'devtools-protocol';
* page.evaluate(() => alert('1')); * page.evaluate(() => alert('1'));
* })(); * })();
* ``` * ```
* @public
*/ */
export class Dialog { export class Dialog {
private _client: CDPSession; private _client: CDPSession;

View File

@ -33,9 +33,13 @@ class CustomError extends Error {
* @public * @public
*/ */
export class TimeoutError extends CustomError {} export class TimeoutError extends CustomError {}
/**
* @public
*/
export type PuppeteerErrors = Record<string, typeof CustomError>; export type PuppeteerErrors = Record<string, typeof CustomError>;
/**
* @public
*/
export const puppeteerErrors: PuppeteerErrors = { export const puppeteerErrors: PuppeteerErrors = {
TimeoutError, TimeoutError,
}; };

View File

@ -20,7 +20,9 @@ import { JSHandle, ElementHandle } from './JSHandle.js';
* @public * @public
*/ */
export type EvaluateFn<T = any> = string | ((arg1: T, ...args: any[]) => any); export type EvaluateFn<T = any> = string | ((arg1: T, ...args: any[]) => any);
/**
* @public
*/
export type UnwrapPromiseLike<T> = T extends PromiseLike<infer U> ? U : T; export type UnwrapPromiseLike<T> = T extends PromiseLike<infer U> ? U : T;
/** /**

View File

@ -5,7 +5,7 @@ import mitt, {
} from '../../vendor/mitt/src/index.js'; } from '../../vendor/mitt/src/index.js';
/** /**
* @internal * @public
*/ */
export interface CommonEventEmitter { export interface CommonEventEmitter {
on(event: EventType, handler: Handler): CommonEventEmitter; on(event: EventType, handler: Handler): CommonEventEmitter;

View File

@ -22,7 +22,9 @@ import { DOMWorld } from './DOMWorld.js';
import { Frame } from './FrameManager.js'; import { Frame } from './FrameManager.js';
import { Protocol } from 'devtools-protocol'; import { Protocol } from 'devtools-protocol';
import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js'; import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js';
/**
* @public
*/
export const EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__'; export const EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__';
const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m; const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
@ -126,8 +128,8 @@ export class ExecutionContext {
* await twoHandle.dispose(); * await twoHandle.dispose();
* console.log(result); // prints '3'. * console.log(result); // prints '3'.
* ``` * ```
* @param pageFunction a function to be evaluated in the `executionContext` * @param pageFunction - a function to be evaluated in the `executionContext`
* @param args argument to pass to the page function * @param args - argument to pass to the page function
* *
* @returns A promise that resolves to the return value of the given function. * @returns A promise that resolves to the return value of the given function.
*/ */
@ -178,8 +180,8 @@ export class ExecutionContext {
* await resultHandle.dispose(); * await resultHandle.dispose();
* ``` * ```
* *
* @param pageFunction a function to be evaluated in the `executionContext` * @param pageFunction - a function to be evaluated in the `executionContext`
* @param args argument to pass to the page function * @param args - argument to pass to the page function
* *
* @returns A promise that resolves to the return value of the given function * @returns A promise that resolves to the return value of the given function
* as an in-page object (a {@link JSHandle}). * as an in-page object (a {@link JSHandle}).
@ -344,7 +346,7 @@ export class ExecutionContext {
* await mapPrototype.dispose(); * await mapPrototype.dispose();
* ``` * ```
* *
* @param prototypeHandle a handle to the object prototype * @param prototypeHandle - a handle to the object prototype
* *
* @returns A handle to an array of objects with the given prototype. * @returns A handle to an array of objects with the given prototype.
*/ */

View File

@ -34,6 +34,7 @@ import { assert } from './assert.js';
* **NOTE** In browsers, only one file chooser can be opened at a time. * **NOTE** In browsers, only one file chooser can be opened at a time.
* All file choosers must be accepted or canceled. Not doing so will prevent * All file choosers must be accepted or canceled. Not doing so will prevent
* subsequent file choosers from appearing. * subsequent file choosers from appearing.
* @public
*/ */
export class FileChooser { export class FileChooser {
private _element: ElementHandle; private _element: ElementHandle;

View File

@ -32,7 +32,9 @@ import {
UnwrapPromiseLike, UnwrapPromiseLike,
} from './EvalTypes.js'; } from './EvalTypes.js';
import { isNode } from '../environment.js'; import { isNode } from '../environment.js';
/**
* @public
*/
export interface BoxModel { export interface BoxModel {
content: Array<{ x: number; y: number }>; content: Array<{ x: number; y: number }>;
padding: Array<{ x: number; y: number }>; padding: Array<{ x: number; y: number }>;

View File

@ -26,7 +26,9 @@ import { HTTPRequest } from './HTTPRequest.js';
import { HTTPResponse } from './HTTPResponse.js'; import { HTTPResponse } from './HTTPResponse.js';
import { NetworkManagerEmittedEvents } from './NetworkManager.js'; import { NetworkManagerEmittedEvents } from './NetworkManager.js';
import { CDPSessionEmittedEvents } from './Connection.js'; import { CDPSessionEmittedEvents } from './Connection.js';
/**
* @public
*/
export type PuppeteerLifeCycleEvent = export type PuppeteerLifeCycleEvent =
| 'load' | 'load'
| 'domcontentloaded' | 'domcontentloaded'

View File

@ -41,7 +41,9 @@ export interface NetworkConditions {
// Latency (ms) // Latency (ms)
latency: number; latency: number;
} }
/**
* @public
*/
export interface InternalNetworkConditions extends NetworkConditions { export interface InternalNetworkConditions extends NetworkConditions {
offline: boolean; offline: boolean;
} }

View File

@ -1049,13 +1049,13 @@ export class Page extends EventEmitter {
* ); * );
* ``` * ```
* *
* @param selector the * @param selector - the
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector} * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
* to query for * to query for
* @param pageFunction the function to be evaluated in the page context. Will * @param pageFunction - the function to be evaluated in the page context. Will
* be passed the result of `Array.from(document.querySelectorAll(selector))` * be passed the result of `Array.from(document.querySelectorAll(selector))`
* as its first argument. * as its first argument.
* @param args any additional arguments to pass through to `pageFunction`. * @param args - any additional arguments to pass through to `pageFunction`.
* *
* @returns The result of calling `pageFunction`. If it returns an element it * @returns The result of calling `pageFunction`. If it returns an element it
* is wrapped in an {@link ElementHandle}, else the raw value itself is * is wrapped in an {@link ElementHandle}, else the raw value itself is
@ -1548,9 +1548,9 @@ export class Page extends EventEmitter {
* await page.emulateIdleState(); * await page.emulateIdleState();
* ``` * ```
* *
* @param overrides Mock idle state. If not set, clears idle overrides * @param overrides - Mock idle state. If not set, clears idle overrides
* @param isUserActive Mock isUserActive * @param isUserActive - Mock isUserActive
* @param isScreenUnlocked Mock isScreenUnlocked * @param isScreenUnlocked - Mock isScreenUnlocked
*/ */
async emulateIdleState(overrides?: { async emulateIdleState(overrides?: {
isUserActive: boolean; isUserActive: boolean;

View File

@ -38,7 +38,9 @@ import {
export interface CommonPuppeteerSettings { export interface CommonPuppeteerSettings {
isPuppeteerCore: boolean; isPuppeteerCore: boolean;
} }
/**
* @public
*/
export interface ConnectOptions extends BrowserConnectOptions { export interface ConnectOptions extends BrowserConnectOptions {
browserWSEndpoint?: string; browserWSEndpoint?: string;
browserURL?: string; browserURL?: string;