Skip to content

Commit

Permalink
docs: replace @return with @returns (#6006)
Browse files Browse the repository at this point in the history
The former is not understood by TSDoc.
  • Loading branch information
jackfranklin committed Jun 12, 2020
1 parent 23f18d8 commit 8a099a0
Show file tree
Hide file tree
Showing 33 changed files with 98 additions and 88 deletions.
2 changes: 1 addition & 1 deletion examples/custom-event.js
Expand Up @@ -30,7 +30,7 @@ const puppeteer = require('puppeteer');
/**
* Attach an event listener to page to capture a custom event on page load/navigation.
* @param {string} type Event name.
* @return {!Promise}
* @returns {!Promise}
*/
function listenFor(type) {
return page.evaluateOnNewDocument((type) => {
Expand Down
2 changes: 1 addition & 1 deletion install.js
Expand Up @@ -97,7 +97,7 @@ async function download() {

/**
* @param {!Array<string>}
* @return {!Promise}
* @returns {!Promise}
*/
function onSuccess(localRevisions) {
if (os.arch() !== 'arm64') {
Expand Down
4 changes: 3 additions & 1 deletion new-docs/puppeteer.browser.waitfortarget.md
Expand Up @@ -17,9 +17,11 @@ waitForTarget(predicate: (x: Target) => boolean, options?: {
| Parameter | Type | Description |
| --- | --- | --- |
| predicate | (x: [Target](./puppeteer.target.md)<!-- -->) =&gt; boolean | |
| options | { timeout?: number; } | {<!-- -->!Promise<!-- -->&lt;<!-- -->!Target<!-- -->&gt;<!-- -->} |
| options | { timeout?: number; } | |

<b>Returns:</b>

Promise&lt;[Target](./puppeteer.target.md)<!-- -->&gt;

{<!-- -->!Promise<!-- -->&lt;<!-- -->!Target<!-- -->&gt;<!-- -->}

4 changes: 3 additions & 1 deletion new-docs/puppeteer.browserfetcher._getfolderpath.md
Expand Up @@ -14,9 +14,11 @@ _getFolderPath(revision: string): string;

| Parameter | Type | Description |
| --- | --- | --- |
| revision | string | {<!-- -->string<!-- -->} |
| revision | string | |

<b>Returns:</b>

string

{<!-- -->string<!-- -->}

4 changes: 3 additions & 1 deletion new-docs/puppeteer.browserfetcher.download.md
Expand Up @@ -15,9 +15,11 @@ download(revision: string, progressCallback: (x: number, y: number) => void): Pr
| Parameter | Type | Description |
| --- | --- | --- |
| revision | string | |
| progressCallback | (x: number, y: number) =&gt; void | {<!-- -->!Promise<!-- -->&lt;<!-- -->!BrowserFetcher.RevisionInfo<!-- -->&gt;<!-- -->} |
| progressCallback | (x: number, y: number) =&gt; void | |

<b>Returns:</b>

Promise&lt;BrowserFetcherRevisionInfo&gt;

{<!-- -->!Promise<!-- -->&lt;<!-- -->!BrowserFetcher.RevisionInfo<!-- -->&gt;<!-- -->}

4 changes: 3 additions & 1 deletion new-docs/puppeteer.connection.createsession.md
Expand Up @@ -14,9 +14,11 @@ createSession(targetInfo: Protocol.Target.TargetInfo): Promise<CDPSession>;

| Parameter | Type | Description |
| --- | --- | --- |
| targetInfo | Protocol.Target.TargetInfo | {<!-- -->!Promise<!-- -->&lt;<!-- -->!CDPSession<!-- -->&gt;<!-- -->} |
| targetInfo | Protocol.Target.TargetInfo | |

<b>Returns:</b>

Promise&lt;[CDPSession](./puppeteer.cdpsession.md)<!-- -->&gt;

{<!-- -->!Promise<!-- -->&lt;<!-- -->!CDPSession<!-- -->&gt;<!-- -->}

4 changes: 3 additions & 1 deletion new-docs/puppeteer.connection.session.md
Expand Up @@ -14,9 +14,11 @@ session(sessionId: string): CDPSession | null;

| Parameter | Type | Description |
| --- | --- | --- |
| sessionId | string | {<!-- -->?CDPSession<!-- -->} |
| sessionId | string | |

<b>Returns:</b>

[CDPSession](./puppeteer.cdpsession.md) \| null

{<!-- -->?CDPSession<!-- -->}

4 changes: 2 additions & 2 deletions new-docs/puppeteer.elementhandle.boxmodel.md
Expand Up @@ -4,8 +4,6 @@

## ElementHandle.boxModel() method

{<!-- -->!Promise<!-- -->&lt;<!-- -->?BoxModel<!-- -->&gt;<!-- -->}

<b>Signature:</b>

```typescript
Expand All @@ -15,3 +13,5 @@ boxModel(): Promise<BoxModel | null>;

Promise&lt;BoxModel \| null&gt;

{<!-- -->!Promise<!-- -->&lt;<!-- -->?BoxModel<!-- -->&gt;<!-- -->}

2 changes: 1 addition & 1 deletion new-docs/puppeteer.elementhandle.md
Expand Up @@ -39,7 +39,7 @@ export declare class ElementHandle extends JSHandle
| [$x(expression)](./puppeteer.elementhandle._x.md) | | |
| [asElement()](./puppeteer.elementhandle.aselement.md) | | |
| [boundingBox()](./puppeteer.elementhandle.boundingbox.md) | | |
| [boxModel()](./puppeteer.elementhandle.boxmodel.md) | | {<!-- -->!Promise<!-- -->&lt;<!-- -->?BoxModel<!-- -->&gt;<!-- -->} |
| [boxModel()](./puppeteer.elementhandle.boxmodel.md) | | |
| [click(options)](./puppeteer.elementhandle.click.md) | | |
| [contentFrame()](./puppeteer.elementhandle.contentframe.md) | | |
| [focus()](./puppeteer.elementhandle.focus.md) | | |
Expand Down
4 changes: 2 additions & 2 deletions new-docs/puppeteer.httprequest.failure.md
Expand Up @@ -4,8 +4,6 @@

## HTTPRequest.failure() method

{<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->}

<b>Signature:</b>

```typescript
Expand All @@ -17,3 +15,5 @@ failure(): {

{ errorText: string; } \| null

{<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->}

2 changes: 1 addition & 1 deletion new-docs/puppeteer.httprequest.md
Expand Up @@ -33,7 +33,7 @@ export declare class HTTPRequest
| --- | --- | --- |
| [abort(errorCode)](./puppeteer.httprequest.abort.md) | | |
| [continue(overrides)](./puppeteer.httprequest.continue.md) | | |
| [failure()](./puppeteer.httprequest.failure.md) | | {<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->} |
| [failure()](./puppeteer.httprequest.failure.md) | | |
| [frame()](./puppeteer.httprequest.frame.md) | | |
| [headers()](./puppeteer.httprequest.headers.md) | | |
| [isNavigationRequest()](./puppeteer.httprequest.isnavigationrequest.md) | | |
Expand Down
2 changes: 1 addition & 1 deletion src/Browser.ts
Expand Up @@ -224,7 +224,7 @@ export class Browser extends EventEmitter {
/**
* @param {function(!Target):boolean} predicate
* @param {{timeout?: number}=} options
* @return {!Promise<!Target>}
* @returns {!Promise<!Target>}
*/
async waitForTarget(
predicate: (x: Target) => boolean,
Expand Down
12 changes: 6 additions & 6 deletions src/BrowserFetcher.ts
Expand Up @@ -84,7 +84,7 @@ function archiveName(
* @param {string} platform
* @param {string} host
* @param {string} revision
* @return {string}
* @returns {string}
*/
function downloadURL(
product: Product,
Expand Down Expand Up @@ -211,7 +211,7 @@ export class BrowserFetcher {
/**
* @param {string} revision
* @param {?function(number, number):void} progressCallback
* @return {!Promise<!BrowserFetcher.RevisionInfo>}
* @returns {!Promise<!BrowserFetcher.RevisionInfo>}
*/
async download(
revision: string,
Expand Down Expand Up @@ -332,7 +332,7 @@ export class BrowserFetcher {

/**
* @param {string} revision
* @return {string}
* @returns {string}
*/
_getFolderPath(revision: string): string {
return path.join(this._downloadsFolder, this._platform + '-' + revision);
Expand All @@ -355,7 +355,7 @@ function parseFolderPath(
* @param {string} url
* @param {string} destinationPath
* @param {?function(number, number):void} progressCallback
* @return {!Promise}
* @returns {!Promise}
*/
function downloadFile(
url: string,
Expand Down Expand Up @@ -417,7 +417,7 @@ function install(archivePath: string, folderPath: string): Promise<unknown> {
/**
* @param {string} tarPath
* @param {string} folderPath
* @return {!Promise<?Error>}
* @returns {!Promise<?Error>}
*/
function extractTar(tarPath: string, folderPath: string): Promise<unknown> {
// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand All @@ -441,7 +441,7 @@ function extractTar(tarPath: string, folderPath: string): Promise<unknown> {
*
* @param {string} dmgPath
* @param {string} folderPath
* @return {!Promise<?Error>}
* @returns {!Promise<?Error>}
*/
function installDMG(dmgPath: string, folderPath: string): Promise<void> {
let mountPath;
Expand Down
8 changes: 4 additions & 4 deletions src/Connection.ts
Expand Up @@ -55,7 +55,7 @@ export class Connection extends EventEmitter {

/**
* @param {string} sessionId
* @return {?CDPSession}
* @returns {?CDPSession}
*/
session(sessionId: string): CDPSession | null {
return this._sessions.get(sessionId) || null;
Expand Down Expand Up @@ -146,7 +146,7 @@ export class Connection extends EventEmitter {

/**
* @param {Protocol.Target.TargetInfo} targetInfo
* @return {!Promise<!CDPSession>}
* @returns {!Promise<!CDPSession>}
*/
async createSession(
targetInfo: Protocol.Target.TargetInfo
Expand Down Expand Up @@ -248,7 +248,7 @@ export class CDPSession extends EventEmitter {
* @param {!Error} error
* @param {string} method
* @param {{error: {message: string, data: any}}} object
* @return {!Error}
* @returns {!Error}
*/
function createProtocolError(
error: Error,
Expand All @@ -263,7 +263,7 @@ function createProtocolError(
/**
* @param {!Error} error
* @param {string} message
* @return {!Error}
* @returns {!Error}
*/
function rewriteError(error: Error, message: string): Error {
error.message = message;
Expand Down
16 changes: 8 additions & 8 deletions src/DOMWorld.ts
Expand Up @@ -93,7 +93,7 @@ export class DOMWorld {
}

/**
* @return {!Promise<!ExecutionContext>}
* @returns {!Promise<!ExecutionContext>}
*/
executionContext(): Promise<ExecutionContext> {
if (this._detached)
Expand All @@ -106,7 +106,7 @@ export class DOMWorld {
/**
* @param {Function|string} pageFunction
* @param {!Array<*>} args
* @return {!Promise<!JSHandle>}
* @returns {!Promise<!JSHandle>}
*/
async evaluateHandle(
pageFunction: Function | string,
Expand All @@ -119,7 +119,7 @@ export class DOMWorld {
/**
* @param {Function|string} pageFunction
* @param {!Array<*>} args
* @return {!Promise<*>}
* @returns {!Promise<*>}
*/
async evaluate<ReturnType extends any>(
pageFunction: Function | string,
Expand All @@ -131,7 +131,7 @@ export class DOMWorld {

/**
* @param {string} selector
* @return {!Promise<?ElementHandle>}
* @returns {!Promise<?ElementHandle>}
*/
async $(selector: string): Promise<ElementHandle | null> {
const document = await this._document();
Expand Down Expand Up @@ -179,7 +179,7 @@ export class DOMWorld {

/**
* @param {string} selector
* @return {!Promise<!Array<!ElementHandle>>}
* @returns {!Promise<!Array<!ElementHandle>>}
*/
async $$(selector: string): Promise<ElementHandle[]> {
const document = await this._document();
Expand Down Expand Up @@ -232,7 +232,7 @@ export class DOMWorld {

/**
* @param {!{url?: string, path?: string, content?: string, type?: string}} options
* @return {!Promise<!ElementHandle>}
* @returns {!Promise<!ElementHandle>}
*/
async addScriptTag(options: {
url?: string;
Expand Down Expand Up @@ -497,7 +497,7 @@ export class DOMWorld {
* @param {boolean} isXPath
* @param {boolean} waitForVisible
* @param {boolean} waitForHidden
* @return {?Node|boolean}
* @returns {?Node|boolean}
*/
function predicate(
selectorOrXPath: string,
Expand Down Expand Up @@ -690,7 +690,7 @@ async function waitForPredicatePageFunction(
if (typeof polling === 'number') return await pollInterval(polling);

/**
* @return {!Promise<*>}
* @returns {!Promise<*>}
*/
async function pollMutation(): Promise<unknown> {
const success = await predicate(...args);
Expand Down
2 changes: 1 addition & 1 deletion src/ExecutionContext.ts
Expand Up @@ -149,7 +149,7 @@ export class ExecutionContext {

/**
* @param {*} arg
* @return {*}
* @returns {*}
* @this {ExecutionContext}
*/
function convertArgument(this: ExecutionContext, arg: unknown): unknown {
Expand Down
2 changes: 1 addition & 1 deletion src/HTTPRequest.ts
Expand Up @@ -102,7 +102,7 @@ export class HTTPRequest {
}

/**
* @return {?{errorText: string}}
* @returns {?{errorText: string}}
*/
failure(): { errorText: string } | null {
if (!this._failureText) return null;
Expand Down
2 changes: 1 addition & 1 deletion src/JSHandle.ts
Expand Up @@ -437,7 +437,7 @@ export class ElementHandle extends JSHandle {
}

/**
* @return {!Promise<?BoxModel>}
* @returns {!Promise<?BoxModel>}
*/
async boxModel(): Promise<BoxModel | null> {
const result = await this._getBoxModel();
Expand Down
2 changes: 1 addition & 1 deletion src/Launcher.ts
Expand Up @@ -154,7 +154,7 @@ class ChromeLauncher implements ProductLauncher {

/**
* @param {!Launcher.ChromeArgOptions=} options
* @return {!Array<string>}
* @returns {!Array<string>}
*/
defaultArgs(options: ChromeArgOptions = {}): string[] {
const chromeArguments = [
Expand Down
2 changes: 1 addition & 1 deletion src/LifecycleWatcher.ts
Expand Up @@ -212,7 +212,7 @@ export class LifecycleWatcher {
/**
* @param {!Frame} frame
* @param {!Array<string>} expectedLifecycle
* @return {boolean}
* @returns {boolean}
*/
function checkLifecycle(
frame: Frame,
Expand Down
8 changes: 4 additions & 4 deletions test/golden-utils.js
Expand Up @@ -33,7 +33,7 @@ const GoldenComparators = {
* @param {?Object} actualBuffer
* @param {!Buffer} expectedBuffer
* @param {!string} mimeType
* @return {?{diff: (!Object:undefined), errorMessage: (string|undefined)}}
* @returns {?{diff: (!Object:undefined), errorMessage: (string|undefined)}}
*/
function compareImages(actualBuffer, expectedBuffer, mimeType) {
if (!actualBuffer || !(actualBuffer instanceof Buffer))
Expand Down Expand Up @@ -67,7 +67,7 @@ function compareImages(actualBuffer, expectedBuffer, mimeType) {
/**
* @param {?Object} actual
* @param {!Buffer} expectedBuffer
* @return {?{diff: (!Object:undefined), errorMessage: (string|undefined)}}
* @returns {?{diff: (!Object:undefined), errorMessage: (string|undefined)}}
*/
function compareText(actual, expectedBuffer) {
if (typeof actual !== 'string')
Expand All @@ -89,7 +89,7 @@ function compareText(actual, expectedBuffer) {
/**
* @param {?Object} actual
* @param {string} goldenName
* @return {!{pass: boolean, message: (undefined|string)}}
* @returns {!{pass: boolean, message: (undefined|string)}}
*/
function compare(goldenPath, outputPath, actual, goldenName) {
goldenPath = path.normalize(goldenPath);
Expand Down Expand Up @@ -149,7 +149,7 @@ function compare(goldenPath, outputPath, actual, goldenName) {
* @param {string} filePath
* @param {string} suffix
* @param {string=} customExtension
* @return {string}
* @returns {string}
*/
function addSuffix(filePath, suffix, customExtension) {
const dirname = path.dirname(filePath);
Expand Down
2 changes: 1 addition & 1 deletion test/requestinterception.spec.js
Expand Up @@ -693,7 +693,7 @@ describe('request interception', function () {

/**
* @param {string} path
* @return {string}
* @returns {string}
*/
function pathToFileURL(path) {
let pathName = path.replace(/\\/g, '/');
Expand Down

0 comments on commit 8a099a0

Please sign in to comment.