docs: replace @return with @returns (#6006)

The former is not understood by TSDoc.
This commit is contained in:
Jack Franklin 2020-06-12 11:38:24 +01:00 committed by GitHub
parent 23f18d8cc0
commit 8a099a0c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 98 additions and 88 deletions

View File

@ -30,7 +30,7 @@ const puppeteer = require('puppeteer');
/** /**
* Attach an event listener to page to capture a custom event on page load/navigation. * Attach an event listener to page to capture a custom event on page load/navigation.
* @param {string} type Event name. * @param {string} type Event name.
* @return {!Promise} * @returns {!Promise}
*/ */
function listenFor(type) { function listenFor(type) {
return page.evaluateOnNewDocument((type) => { return page.evaluateOnNewDocument((type) => {

View File

@ -97,7 +97,7 @@ async function download() {
/** /**
* @param {!Array<string>} * @param {!Array<string>}
* @return {!Promise} * @returns {!Promise}
*/ */
function onSuccess(localRevisions) { function onSuccess(localRevisions) {
if (os.arch() !== 'arm64') { if (os.arch() !== 'arm64') {

View File

@ -17,9 +17,11 @@ waitForTarget(predicate: (x: Target) => boolean, options?: {
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| predicate | (x: [Target](./puppeteer.target.md)<!-- -->) =&gt; boolean | | | predicate | (x: [Target](./puppeteer.target.md)<!-- -->) =&gt; boolean | |
| options | { timeout?: number; } | {<!-- -->!Promise<!-- -->&lt;<!-- -->!Target<!-- -->&gt;<!-- -->} | | options | { timeout?: number; } | |
<b>Returns:</b> <b>Returns:</b>
Promise&lt;[Target](./puppeteer.target.md)<!-- -->&gt; Promise&lt;[Target](./puppeteer.target.md)<!-- -->&gt;
{<!-- -->!Promise<!-- -->&lt;<!-- -->!Target<!-- -->&gt;<!-- -->}

View File

@ -14,9 +14,11 @@ _getFolderPath(revision: string): string;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| revision | string | {<!-- -->string<!-- -->} | | revision | string | |
<b>Returns:</b> <b>Returns:</b>
string string
{<!-- -->string<!-- -->}

View File

@ -15,9 +15,11 @@ download(revision: string, progressCallback: (x: number, y: number) => void): Pr
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| revision | string | | | revision | string | |
| progressCallback | (x: number, y: number) =&gt; void | {<!-- -->!Promise<!-- -->&lt;<!-- -->!BrowserFetcher.RevisionInfo<!-- -->&gt;<!-- -->} | | progressCallback | (x: number, y: number) =&gt; void | |
<b>Returns:</b> <b>Returns:</b>
Promise&lt;BrowserFetcherRevisionInfo&gt; Promise&lt;BrowserFetcherRevisionInfo&gt;
{<!-- -->!Promise<!-- -->&lt;<!-- -->!BrowserFetcher.RevisionInfo<!-- -->&gt;<!-- -->}

View File

@ -14,9 +14,11 @@ createSession(targetInfo: Protocol.Target.TargetInfo): Promise<CDPSession>;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| targetInfo | Protocol.Target.TargetInfo | {<!-- -->!Promise<!-- -->&lt;<!-- -->!CDPSession<!-- -->&gt;<!-- -->} | | targetInfo | Protocol.Target.TargetInfo | |
<b>Returns:</b> <b>Returns:</b>
Promise&lt;[CDPSession](./puppeteer.cdpsession.md)<!-- -->&gt; Promise&lt;[CDPSession](./puppeteer.cdpsession.md)<!-- -->&gt;
{<!-- -->!Promise<!-- -->&lt;<!-- -->!CDPSession<!-- -->&gt;<!-- -->}

View File

@ -14,9 +14,11 @@ session(sessionId: string): CDPSession | null;
| Parameter | Type | Description | | Parameter | Type | Description |
| --- | --- | --- | | --- | --- | --- |
| sessionId | string | {<!-- -->?CDPSession<!-- -->} | | sessionId | string | |
<b>Returns:</b> <b>Returns:</b>
[CDPSession](./puppeteer.cdpsession.md) \| null [CDPSession](./puppeteer.cdpsession.md) \| null
{<!-- -->?CDPSession<!-- -->}

View File

@ -4,8 +4,6 @@
## ElementHandle.boxModel() method ## ElementHandle.boxModel() method
{<!-- -->!Promise<!-- -->&lt;<!-- -->?BoxModel<!-- -->&gt;<!-- -->}
<b>Signature:</b> <b>Signature:</b>
```typescript ```typescript
@ -15,3 +13,5 @@ boxModel(): Promise<BoxModel | null>;
Promise&lt;BoxModel \| null&gt; Promise&lt;BoxModel \| null&gt;
{<!-- -->!Promise<!-- -->&lt;<!-- -->?BoxModel<!-- -->&gt;<!-- -->}

View File

@ -39,7 +39,7 @@ export declare class ElementHandle extends JSHandle
| [$x(expression)](./puppeteer.elementhandle._x.md) | | | | [$x(expression)](./puppeteer.elementhandle._x.md) | | |
| [asElement()](./puppeteer.elementhandle.aselement.md) | | | | [asElement()](./puppeteer.elementhandle.aselement.md) | | |
| [boundingBox()](./puppeteer.elementhandle.boundingbox.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) | | | | [click(options)](./puppeteer.elementhandle.click.md) | | |
| [contentFrame()](./puppeteer.elementhandle.contentframe.md) | | | | [contentFrame()](./puppeteer.elementhandle.contentframe.md) | | |
| [focus()](./puppeteer.elementhandle.focus.md) | | | | [focus()](./puppeteer.elementhandle.focus.md) | | |

View File

@ -4,8 +4,6 @@
## HTTPRequest.failure() method ## HTTPRequest.failure() method
{<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->}
<b>Signature:</b> <b>Signature:</b>
```typescript ```typescript
@ -17,3 +15,5 @@ failure(): {
{ errorText: string; } \| null { errorText: string; } \| null
{<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->}

View File

@ -33,7 +33,7 @@ export declare class HTTPRequest
| --- | --- | --- | | --- | --- | --- |
| [abort(errorCode)](./puppeteer.httprequest.abort.md) | | | | [abort(errorCode)](./puppeteer.httprequest.abort.md) | | |
| [continue(overrides)](./puppeteer.httprequest.continue.md) | | | | [continue(overrides)](./puppeteer.httprequest.continue.md) | | |
| [failure()](./puppeteer.httprequest.failure.md) | | {<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->} | | [failure()](./puppeteer.httprequest.failure.md) | | |
| [frame()](./puppeteer.httprequest.frame.md) | | | | [frame()](./puppeteer.httprequest.frame.md) | | |
| [headers()](./puppeteer.httprequest.headers.md) | | | | [headers()](./puppeteer.httprequest.headers.md) | | |
| [isNavigationRequest()](./puppeteer.httprequest.isnavigationrequest.md) | | | | [isNavigationRequest()](./puppeteer.httprequest.isnavigationrequest.md) | | |

View File

@ -224,7 +224,7 @@ export class Browser extends EventEmitter {
/** /**
* @param {function(!Target):boolean} predicate * @param {function(!Target):boolean} predicate
* @param {{timeout?: number}=} options * @param {{timeout?: number}=} options
* @return {!Promise<!Target>} * @returns {!Promise<!Target>}
*/ */
async waitForTarget( async waitForTarget(
predicate: (x: Target) => boolean, predicate: (x: Target) => boolean,

View File

@ -84,7 +84,7 @@ function archiveName(
* @param {string} platform * @param {string} platform
* @param {string} host * @param {string} host
* @param {string} revision * @param {string} revision
* @return {string} * @returns {string}
*/ */
function downloadURL( function downloadURL(
product: Product, product: Product,
@ -211,7 +211,7 @@ export class BrowserFetcher {
/** /**
* @param {string} revision * @param {string} revision
* @param {?function(number, number):void} progressCallback * @param {?function(number, number):void} progressCallback
* @return {!Promise<!BrowserFetcher.RevisionInfo>} * @returns {!Promise<!BrowserFetcher.RevisionInfo>}
*/ */
async download( async download(
revision: string, revision: string,
@ -332,7 +332,7 @@ export class BrowserFetcher {
/** /**
* @param {string} revision * @param {string} revision
* @return {string} * @returns {string}
*/ */
_getFolderPath(revision: string): string { _getFolderPath(revision: string): string {
return path.join(this._downloadsFolder, this._platform + '-' + revision); return path.join(this._downloadsFolder, this._platform + '-' + revision);
@ -355,7 +355,7 @@ function parseFolderPath(
* @param {string} url * @param {string} url
* @param {string} destinationPath * @param {string} destinationPath
* @param {?function(number, number):void} progressCallback * @param {?function(number, number):void} progressCallback
* @return {!Promise} * @returns {!Promise}
*/ */
function downloadFile( function downloadFile(
url: string, url: string,
@ -417,7 +417,7 @@ function install(archivePath: string, folderPath: string): Promise<unknown> {
/** /**
* @param {string} tarPath * @param {string} tarPath
* @param {string} folderPath * @param {string} folderPath
* @return {!Promise<?Error>} * @returns {!Promise<?Error>}
*/ */
function extractTar(tarPath: string, folderPath: string): Promise<unknown> { function extractTar(tarPath: string, folderPath: string): Promise<unknown> {
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
@ -441,7 +441,7 @@ function extractTar(tarPath: string, folderPath: string): Promise<unknown> {
* *
* @param {string} dmgPath * @param {string} dmgPath
* @param {string} folderPath * @param {string} folderPath
* @return {!Promise<?Error>} * @returns {!Promise<?Error>}
*/ */
function installDMG(dmgPath: string, folderPath: string): Promise<void> { function installDMG(dmgPath: string, folderPath: string): Promise<void> {
let mountPath; let mountPath;

View File

@ -55,7 +55,7 @@ export class Connection extends EventEmitter {
/** /**
* @param {string} sessionId * @param {string} sessionId
* @return {?CDPSession} * @returns {?CDPSession}
*/ */
session(sessionId: string): CDPSession | null { session(sessionId: string): CDPSession | null {
return this._sessions.get(sessionId) || null; return this._sessions.get(sessionId) || null;
@ -146,7 +146,7 @@ export class Connection extends EventEmitter {
/** /**
* @param {Protocol.Target.TargetInfo} targetInfo * @param {Protocol.Target.TargetInfo} targetInfo
* @return {!Promise<!CDPSession>} * @returns {!Promise<!CDPSession>}
*/ */
async createSession( async createSession(
targetInfo: Protocol.Target.TargetInfo targetInfo: Protocol.Target.TargetInfo
@ -248,7 +248,7 @@ export class CDPSession extends EventEmitter {
* @param {!Error} error * @param {!Error} error
* @param {string} method * @param {string} method
* @param {{error: {message: string, data: any}}} object * @param {{error: {message: string, data: any}}} object
* @return {!Error} * @returns {!Error}
*/ */
function createProtocolError( function createProtocolError(
error: Error, error: Error,
@ -263,7 +263,7 @@ function createProtocolError(
/** /**
* @param {!Error} error * @param {!Error} error
* @param {string} message * @param {string} message
* @return {!Error} * @returns {!Error}
*/ */
function rewriteError(error: Error, message: string): Error { function rewriteError(error: Error, message: string): Error {
error.message = message; error.message = message;

View File

@ -93,7 +93,7 @@ export class DOMWorld {
} }
/** /**
* @return {!Promise<!ExecutionContext>} * @returns {!Promise<!ExecutionContext>}
*/ */
executionContext(): Promise<ExecutionContext> { executionContext(): Promise<ExecutionContext> {
if (this._detached) if (this._detached)
@ -106,7 +106,7 @@ export class DOMWorld {
/** /**
* @param {Function|string} pageFunction * @param {Function|string} pageFunction
* @param {!Array<*>} args * @param {!Array<*>} args
* @return {!Promise<!JSHandle>} * @returns {!Promise<!JSHandle>}
*/ */
async evaluateHandle( async evaluateHandle(
pageFunction: Function | string, pageFunction: Function | string,
@ -119,7 +119,7 @@ export class DOMWorld {
/** /**
* @param {Function|string} pageFunction * @param {Function|string} pageFunction
* @param {!Array<*>} args * @param {!Array<*>} args
* @return {!Promise<*>} * @returns {!Promise<*>}
*/ */
async evaluate<ReturnType extends any>( async evaluate<ReturnType extends any>(
pageFunction: Function | string, pageFunction: Function | string,
@ -131,7 +131,7 @@ export class DOMWorld {
/** /**
* @param {string} selector * @param {string} selector
* @return {!Promise<?ElementHandle>} * @returns {!Promise<?ElementHandle>}
*/ */
async $(selector: string): Promise<ElementHandle | null> { async $(selector: string): Promise<ElementHandle | null> {
const document = await this._document(); const document = await this._document();
@ -179,7 +179,7 @@ export class DOMWorld {
/** /**
* @param {string} selector * @param {string} selector
* @return {!Promise<!Array<!ElementHandle>>} * @returns {!Promise<!Array<!ElementHandle>>}
*/ */
async $$(selector: string): Promise<ElementHandle[]> { async $$(selector: string): Promise<ElementHandle[]> {
const document = await this._document(); const document = await this._document();
@ -232,7 +232,7 @@ export class DOMWorld {
/** /**
* @param {!{url?: string, path?: string, content?: string, type?: string}} options * @param {!{url?: string, path?: string, content?: string, type?: string}} options
* @return {!Promise<!ElementHandle>} * @returns {!Promise<!ElementHandle>}
*/ */
async addScriptTag(options: { async addScriptTag(options: {
url?: string; url?: string;
@ -497,7 +497,7 @@ export class DOMWorld {
* @param {boolean} isXPath * @param {boolean} isXPath
* @param {boolean} waitForVisible * @param {boolean} waitForVisible
* @param {boolean} waitForHidden * @param {boolean} waitForHidden
* @return {?Node|boolean} * @returns {?Node|boolean}
*/ */
function predicate( function predicate(
selectorOrXPath: string, selectorOrXPath: string,
@ -690,7 +690,7 @@ async function waitForPredicatePageFunction(
if (typeof polling === 'number') return await pollInterval(polling); if (typeof polling === 'number') return await pollInterval(polling);
/** /**
* @return {!Promise<*>} * @returns {!Promise<*>}
*/ */
async function pollMutation(): Promise<unknown> { async function pollMutation(): Promise<unknown> {
const success = await predicate(...args); const success = await predicate(...args);

View File

@ -149,7 +149,7 @@ export class ExecutionContext {
/** /**
* @param {*} arg * @param {*} arg
* @return {*} * @returns {*}
* @this {ExecutionContext} * @this {ExecutionContext}
*/ */
function convertArgument(this: ExecutionContext, arg: unknown): unknown { function convertArgument(this: ExecutionContext, arg: unknown): unknown {

View File

@ -102,7 +102,7 @@ export class HTTPRequest {
} }
/** /**
* @return {?{errorText: string}} * @returns {?{errorText: string}}
*/ */
failure(): { errorText: string } | null { failure(): { errorText: string } | null {
if (!this._failureText) return null; if (!this._failureText) return null;

View File

@ -437,7 +437,7 @@ export class ElementHandle extends JSHandle {
} }
/** /**
* @return {!Promise<?BoxModel>} * @returns {!Promise<?BoxModel>}
*/ */
async boxModel(): Promise<BoxModel | null> { async boxModel(): Promise<BoxModel | null> {
const result = await this._getBoxModel(); const result = await this._getBoxModel();

View File

@ -154,7 +154,7 @@ class ChromeLauncher implements ProductLauncher {
/** /**
* @param {!Launcher.ChromeArgOptions=} options * @param {!Launcher.ChromeArgOptions=} options
* @return {!Array<string>} * @returns {!Array<string>}
*/ */
defaultArgs(options: ChromeArgOptions = {}): string[] { defaultArgs(options: ChromeArgOptions = {}): string[] {
const chromeArguments = [ const chromeArguments = [

View File

@ -212,7 +212,7 @@ export class LifecycleWatcher {
/** /**
* @param {!Frame} frame * @param {!Frame} frame
* @param {!Array<string>} expectedLifecycle * @param {!Array<string>} expectedLifecycle
* @return {boolean} * @returns {boolean}
*/ */
function checkLifecycle( function checkLifecycle(
frame: Frame, frame: Frame,

View File

@ -33,7 +33,7 @@ const GoldenComparators = {
* @param {?Object} actualBuffer * @param {?Object} actualBuffer
* @param {!Buffer} expectedBuffer * @param {!Buffer} expectedBuffer
* @param {!string} mimeType * @param {!string} mimeType
* @return {?{diff: (!Object:undefined), errorMessage: (string|undefined)}} * @returns {?{diff: (!Object:undefined), errorMessage: (string|undefined)}}
*/ */
function compareImages(actualBuffer, expectedBuffer, mimeType) { function compareImages(actualBuffer, expectedBuffer, mimeType) {
if (!actualBuffer || !(actualBuffer instanceof Buffer)) if (!actualBuffer || !(actualBuffer instanceof Buffer))
@ -67,7 +67,7 @@ function compareImages(actualBuffer, expectedBuffer, mimeType) {
/** /**
* @param {?Object} actual * @param {?Object} actual
* @param {!Buffer} expectedBuffer * @param {!Buffer} expectedBuffer
* @return {?{diff: (!Object:undefined), errorMessage: (string|undefined)}} * @returns {?{diff: (!Object:undefined), errorMessage: (string|undefined)}}
*/ */
function compareText(actual, expectedBuffer) { function compareText(actual, expectedBuffer) {
if (typeof actual !== 'string') if (typeof actual !== 'string')
@ -89,7 +89,7 @@ function compareText(actual, expectedBuffer) {
/** /**
* @param {?Object} actual * @param {?Object} actual
* @param {string} goldenName * @param {string} goldenName
* @return {!{pass: boolean, message: (undefined|string)}} * @returns {!{pass: boolean, message: (undefined|string)}}
*/ */
function compare(goldenPath, outputPath, actual, goldenName) { function compare(goldenPath, outputPath, actual, goldenName) {
goldenPath = path.normalize(goldenPath); goldenPath = path.normalize(goldenPath);
@ -149,7 +149,7 @@ function compare(goldenPath, outputPath, actual, goldenName) {
* @param {string} filePath * @param {string} filePath
* @param {string} suffix * @param {string} suffix
* @param {string=} customExtension * @param {string=} customExtension
* @return {string} * @returns {string}
*/ */
function addSuffix(filePath, suffix, customExtension) { function addSuffix(filePath, suffix, customExtension) {
const dirname = path.dirname(filePath); const dirname = path.dirname(filePath);

View File

@ -693,7 +693,7 @@ describe('request interception', function () {
/** /**
* @param {string} path * @param {string} path
* @return {string} * @returns {string}
*/ */
function pathToFileURL(path) { function pathToFileURL(path) {
let pathName = path.replace(/\\/g, '/'); let pathName = path.replace(/\\/g, '/');

View File

@ -42,7 +42,7 @@ const utils = (module.exports = {
}, },
/** /**
* @return {string} * @returns {string}
*/ */
projectRoot: function () { projectRoot: function () {
return PROJECT_ROOT; return PROJECT_ROOT;
@ -52,7 +52,7 @@ const utils = (module.exports = {
* @param {!Page} page * @param {!Page} page
* @param {string} frameId * @param {string} frameId
* @param {string} url * @param {string} url
* @return {!Frame} * @returns {!Frame}
*/ */
attachFrame: async function (page, frameId, url) { attachFrame: async function (page, frameId, url) {
const handle = await page.evaluateHandle(attachFrame, frameId, url); const handle = await page.evaluateHandle(attachFrame, frameId, url);
@ -103,7 +103,7 @@ const utils = (module.exports = {
/** /**
* @param {!Frame} frame * @param {!Frame} frame
* @param {string=} indentation * @param {string=} indentation
* @return {Array<string>} * @returns {Array<string>}
*/ */
dumpFrames: function (frame, indentation) { dumpFrames: function (frame, indentation) {
indentation = indentation || ''; indentation = indentation || '';
@ -118,7 +118,7 @@ const utils = (module.exports = {
/** /**
* @param {!EventEmitter} emitter * @param {!EventEmitter} emitter
* @param {string} eventName * @param {string} eventName
* @return {!Promise<!Object>} * @returns {!Promise<!Object>}
*/ */
waitEvent: function (emitter, eventName, predicate = () => true) { waitEvent: function (emitter, eventName, predicate = () => true) {
return new Promise((fulfill) => { return new Promise((fulfill) => {

View File

@ -203,7 +203,7 @@ async function checkRangeAvailability({
* @param {!Table} table * @param {!Table} table
* @param {string} name * @param {string} name
* @param {number} revision * @param {number} revision
* @return {boolean} * @returns {boolean}
*/ */
async function checkAndDrawRevisionAvailability(table, name, revision) { async function checkAndDrawRevisionAvailability(table, name, revision) {
const promises = fetchers.map((fetcher) => fetcher.canDownload(revision)); const promises = fetchers.map((fetcher) => fetcher.canDownload(revision));
@ -225,7 +225,7 @@ async function checkAndDrawRevisionAvailability(table, name, revision) {
/** /**
* @param {string} url * @param {string} url
* @return {!Promise<?string>} * @returns {!Promise<?string>}
*/ */
function fetch(url) { function fetch(url) {
let resolve; let resolve;
@ -253,7 +253,7 @@ function fetch(url) {
/** /**
* @param {number} size * @param {number} size
* @return {string} * @returns {string}
*/ */
function spaceString(size) { function spaceString(size) {
return new Array(size).fill(' ').join(''); return new Array(size).fill(' ').join('');
@ -261,7 +261,7 @@ function spaceString(size) {
/** /**
* @param {string} text * @param {string} text
* @return {string} * @returns {string}
*/ */
function filterOutColors(text) { function filterOutColors(text) {
for (const colorName in colors) { for (const colorName in colors) {
@ -274,7 +274,7 @@ function filterOutColors(text) {
/** /**
* @param {string} text * @param {string} text
* @param {number} length * @param {number} length
* @return {string} * @returns {string}
*/ */
function padCenter(text, length) { function padCenter(text, length) {
const printableCharacters = filterOutColors(text); const printableCharacters = filterOutColors(text);

View File

@ -26,7 +26,7 @@ class Message {
/** /**
* @param {string} text * @param {string} text
* @return {!Message} * @returns {!Message}
*/ */
static error(text) { static error(text) {
return new Message('error', text); return new Message('error', text);
@ -34,7 +34,7 @@ class Message {
/** /**
* @param {string} text * @param {string} text
* @return {!Message} * @returns {!Message}
*/ */
static warning(text) { static warning(text) {
return new Message('warning', text); return new Message('warning', text);

View File

@ -38,21 +38,21 @@ class Source {
} }
/** /**
* @return {string} * @returns {string}
*/ */
filePath() { filePath() {
return this._filePath; return this._filePath;
} }
/** /**
* @return {string} * @returns {string}
*/ */
projectPath() { projectPath() {
return this._projectPath; return this._projectPath;
} }
/** /**
* @return {string} * @returns {string}
*/ */
name() { name() {
return this._name; return this._name;
@ -60,7 +60,7 @@ class Source {
/** /**
* @param {string} text * @param {string} text
* @return {boolean} * @returns {boolean}
*/ */
setText(text) { setText(text) {
if (text === this._text) return false; if (text === this._text) return false;
@ -70,14 +70,14 @@ class Source {
} }
/** /**
* @return {string} * @returns {string}
*/ */
text() { text() {
return this._text; return this._text;
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
hasUpdatedText() { hasUpdatedText() {
return this._hasUpdatedText; return this._hasUpdatedText;
@ -89,7 +89,7 @@ class Source {
/** /**
* @param {string} filePath * @param {string} filePath
* @return {!Promise<Source>} * @returns {!Promise<Source>}
*/ */
static async readFile(filePath) { static async readFile(filePath) {
filePath = path.resolve(filePath); filePath = path.resolve(filePath);
@ -100,7 +100,7 @@ class Source {
/** /**
* @param {string} dirPath * @param {string} dirPath
* @param {string=} extension * @param {string=} extension
* @return {!Promise<!Array<!Source>>} * @returns {!Promise<!Array<!Source>>}
*/ */
static async readdir(dirPath, extension = '') { static async readdir(dirPath, extension = '') {
const fileNames = await readdirAsync(dirPath); const fileNames = await readdirAsync(dirPath);

View File

@ -100,7 +100,7 @@ Documentation.Member = class {
* @param {string} name * @param {string} name
* @param {!Array<!Documentation.Member>} argsArray * @param {!Array<!Documentation.Member>} argsArray
* @param {?Documentation.Type} returnType * @param {?Documentation.Type} returnType
* @return {!Documentation.Member} * @returns {!Documentation.Member}
*/ */
static createMethod(name, argsArray, returnType, returnComment, comment) { static createMethod(name, argsArray, returnType, returnComment, comment) {
return new Documentation.Member( return new Documentation.Member(
@ -118,7 +118,7 @@ Documentation.Member = class {
* @param {!Documentation.Type} type * @param {!Documentation.Type} type
* @param {string=} comment * @param {string=} comment
* @param {boolean=} required * @param {boolean=} required
* @return {!Documentation.Member} * @returns {!Documentation.Member}
*/ */
static createProperty(name, type, comment, required) { static createProperty(name, type, comment, required) {
return new Documentation.Member( return new Documentation.Member(
@ -136,7 +136,7 @@ Documentation.Member = class {
* @param {string} name * @param {string} name
* @param {?Documentation.Type=} type * @param {?Documentation.Type=} type
* @param {string=} comment * @param {string=} comment
* @return {!Documentation.Member} * @returns {!Documentation.Member}
*/ */
static createEvent(name, type = null, comment) { static createEvent(name, type = null, comment) {
return new Documentation.Member('event', name, type, [], comment); return new Documentation.Member('event', name, type, [], comment);

View File

@ -68,7 +68,7 @@ function checkSources(sources) {
/** /**
* @param {!Array<!Documentation.Class>} classes * @param {!Array<!Documentation.Class>} classes
* @param {!Map<string, string>} inheritance * @param {!Map<string, string>} inheritance
* @return {!Array<!Documentation.Class>} * @returns {!Array<!Documentation.Class>}
*/ */
function recreateClassesWithInheritance(classes, inheritance) { function recreateClassesWithInheritance(classes, inheritance) {
const classesByName = new Map(classes.map((cls) => [cls.name, cls])); const classesByName = new Map(classes.map((cls) => [cls.name, cls]));
@ -155,7 +155,7 @@ function checkSources(sources) {
/** /**
* @param {!ts.Type} type * @param {!ts.Type} type
* @return {!Documentation.Type} * @returns {!Documentation.Type}
*/ */
function serializeType(type, circular = []) { function serializeType(type, circular = []) {
let typeName = checker.typeToString(type); let typeName = checker.typeToString(type);
@ -207,7 +207,7 @@ function checkSources(sources) {
/** /**
* @param {!ts.Symbol} symbol * @param {!ts.Symbol} symbol
* @return {boolean} * @returns {boolean}
*/ */
function symbolHasPrivateModifier(symbol) { function symbolHasPrivateModifier(symbol) {
const modifiers = const modifiers =
@ -220,7 +220,7 @@ function checkSources(sources) {
/** /**
* @param {string} className * @param {string} className
* @param {!ts.Symbol} symbol * @param {!ts.Symbol} symbol
* @return {} * @returns {}
*/ */
function serializeClass(className, symbol, node) { function serializeClass(className, symbol, node) {
/** @type {!Array<!Documentation.Member>} */ /** @type {!Array<!Documentation.Member>} */

View File

@ -21,7 +21,7 @@ class MDOutline {
/** /**
* @param {!Page} page * @param {!Page} page
* @param {string} text * @param {string} text
* @return {!MDOutline} * @returns {!MDOutline}
*/ */
static async create(page, text) { static async create(page, text) {
// Render markdown as HTML. // Render markdown as HTML.
@ -86,7 +86,7 @@ class MDOutline {
/** /**
* @param {string} str * @param {string} str
* @return {string} * @returns {string}
*/ */
function findType(str) { function findType(str) {
const start = str.indexOf('<') + 1; const start = str.indexOf('<') + 1;
@ -227,7 +227,7 @@ class MDOutline {
/** /**
* @param {!Node} fromInclusive * @param {!Node} fromInclusive
* @param {!Node} toExclusive * @param {!Node} toExclusive
* @return {!DocumentFragment} * @returns {!DocumentFragment}
*/ */
function extractSiblingsIntoFragment(fromInclusive, toExclusive) { function extractSiblingsIntoFragment(fromInclusive, toExclusive) {
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
@ -387,7 +387,7 @@ class MDOutline {
/** /**
* @param {!Page} page * @param {!Page} page
* @param {!Array<!Source>} sources * @param {!Array<!Source>} sources
* @return {!Promise<{documentation: !Documentation, errors: !Array<string>}>} * @returns {!Promise<{documentation: !Documentation, errors: !Array<string>}>}
*/ */
module.exports = async function (page, sources) { module.exports = async function (page, sources) {
const classes = []; const classes = [];

View File

@ -30,7 +30,7 @@ const EXCLUDE_PROPERTIES = new Set([
/** /**
* @param {!Page} page * @param {!Page} page
* @param {!Array<!Source>} mdSources * @param {!Array<!Source>} mdSources
* @return {!Promise<!Array<!Message>>} * @returns {!Promise<!Array<!Message>>}
*/ */
module.exports = async function lint(page, mdSources, jsSources) { module.exports = async function lint(page, mdSources, jsSources) {
const mdResult = await mdBuilder(page, mdSources); const mdResult = await mdBuilder(page, mdSources);
@ -57,7 +57,7 @@ module.exports = async function lint(page, mdSources, jsSources) {
/** /**
* @param {!Documentation} doc * @param {!Documentation} doc
* @return {!Array<string>} * @returns {!Array<string>}
*/ */
function checkSorting(doc) { function checkSorting(doc) {
const errors = []; const errors = [];
@ -122,7 +122,7 @@ function checkSorting(doc) {
/** /**
* @param {!Array<!Source>} jsSources * @param {!Array<!Source>} jsSources
* @param {!Documentation} jsDocumentation * @param {!Documentation} jsDocumentation
* @return {!Documentation} * @returns {!Documentation}
*/ */
function filterJSDocumentation(jsSources, jsDocumentation) { function filterJSDocumentation(jsSources, jsDocumentation) {
const apijs = jsSources.find((source) => source.name() === 'api.js'); const apijs = jsSources.find((source) => source.name() === 'api.js');
@ -142,7 +142,7 @@ function filterJSDocumentation(jsSources, jsDocumentation) {
/** /**
* @param {!Documentation} doc * @param {!Documentation} doc
* @return {!Array<string>} * @returns {!Array<string>}
*/ */
function checkDuplicates(doc) { function checkDuplicates(doc) {
const errors = []; const errors = [];
@ -183,7 +183,7 @@ const expectedNonExistingMethods = new Map([
/** /**
* @param {!Documentation} actual * @param {!Documentation} actual
* @param {!Documentation} expected * @param {!Documentation} expected
* @return {!Array<string>} * @returns {!Array<string>}
*/ */
function compareDocumentations(actual, expected) { function compareDocumentations(actual, expected) {
const errors = []; const errors = [];
@ -684,7 +684,7 @@ function compareDocumentations(actual, expected) {
/** /**
* @param {!Array<string>} actual * @param {!Array<string>} actual
* @param {!Array<string>} expected * @param {!Array<string>} expected
* @return {{extra: !Array<string>, missing: !Array<string>, equal: !Array<string>}} * @returns {{extra: !Array<string>, missing: !Array<string>, equal: !Array<string>}}
*/ */
function diff(actual, expected) { function diff(actual, expected) {
const N = actual.length; const N = actual.length;

View File

@ -89,7 +89,7 @@ module.exports.runCommands = function (sources, version) {
/** /**
* @param {{name: string, from: number, to: number, source: !Source}} command * @param {{name: string, from: number, to: number, source: !Source}} command
* @param {string} editText * @param {string} editText
* @return {boolean} * @returns {boolean}
*/ */
function applyCommand(command, editText) { function applyCommand(command, editText) {
const text = command.source.text(); const text = command.source.text();

View File

@ -123,7 +123,7 @@ async function main(url) {
* @param {string} deviceName * @param {string} deviceName
* @param {*} descriptor * @param {*} descriptor
* @param {boolean} landscape * @param {boolean} landscape
* @return {!Object} * @returns {!Object}
*/ */
function createDevice(chromeVersion, deviceName, descriptor, landscape) { function createDevice(chromeVersion, deviceName, descriptor, landscape) {
const devicePayload = loadFromJSONV1(descriptor); const devicePayload = loadFromJSONV1(descriptor);
@ -148,7 +148,7 @@ function createDevice(chromeVersion, deviceName, descriptor, landscape) {
/** /**
* @param {*} json * @param {*} json
* @return {?Object} * @returns {?Object}
*/ */
function loadFromJSONV1(json) { function loadFromJSONV1(json) {
/** /**
@ -156,7 +156,7 @@ function loadFromJSONV1(json) {
* @param {string} key * @param {string} key
* @param {string} type * @param {string} type
* @param {*=} defaultValue * @param {*=} defaultValue
* @return {*} * @returns {*}
*/ */
function parseValue(object, key, type, defaultValue) { function parseValue(object, key, type, defaultValue) {
if ( if (
@ -184,7 +184,7 @@ function loadFromJSONV1(json) {
/** /**
* @param {*} object * @param {*} object
* @param {string} key * @param {string} key
* @return {number} * @returns {number}
*/ */
function parseIntValue(object, key) { function parseIntValue(object, key) {
const value = /** @type {number} */ (parseValue(object, key, 'number')); const value = /** @type {number} */ (parseValue(object, key, 'number'));
@ -195,7 +195,7 @@ function loadFromJSONV1(json) {
/** /**
* @param {*} json * @param {*} json
* @return {!{width: number, height: number}} * @returns {!{width: number, height: number}}
*/ */
function parseOrientation(json) { function parseOrientation(json) {
const result = {}; const result = {};
@ -259,7 +259,7 @@ function loadFromJSONV1(json) {
/** /**
* @param {url} * @param {url}
* @return {!Promise} * @returns {!Promise}
*/ */
function httpGET(url) { function httpGET(url) {
let fulfill, reject; let fulfill, reject;

View File

@ -29,7 +29,7 @@ class TestServer {
/** /**
* @param {string} dirPath * @param {string} dirPath
* @param {number} port * @param {number} port
* @return {!TestServer} * @returns {!TestServer}
*/ */
static async create(dirPath, port) { static async create(dirPath, port) {
const server = new TestServer(dirPath, port); const server = new TestServer(dirPath, port);
@ -40,7 +40,7 @@ class TestServer {
/** /**
* @param {string} dirPath * @param {string} dirPath
* @param {number} port * @param {number} port
* @return {!TestServer} * @returns {!TestServer}
*/ */
static async createHTTPS(dirPath, port) { static async createHTTPS(dirPath, port) {
const server = new TestServer(dirPath, port, { const server = new TestServer(dirPath, port, {
@ -151,7 +151,7 @@ class TestServer {
/** /**
* @param {string} path * @param {string} path
* @return {!Promise<!IncomingMessage>} * @returns {!Promise<!IncomingMessage>}
*/ */
waitForRequest(path) { waitForRequest(path) {
let promise = this._requestSubscribers.get(path); let promise = this._requestSubscribers.get(path);