mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs: replace @return with @returns (#6006)
The former is not understood by TSDoc.
This commit is contained in:
parent
23f18d8cc0
commit
8a099a0c2c
@ -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) => {
|
||||
|
@ -97,7 +97,7 @@ async function download() {
|
||||
|
||||
/**
|
||||
* @param {!Array<string>}
|
||||
* @return {!Promise}
|
||||
* @returns {!Promise}
|
||||
*/
|
||||
function onSuccess(localRevisions) {
|
||||
if (os.arch() !== 'arm64') {
|
||||
|
@ -17,9 +17,11 @@ waitForTarget(predicate: (x: Target) => boolean, options?: {
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| predicate | (x: [Target](./puppeteer.target.md)<!-- -->) => boolean | |
|
||||
| options | { timeout?: number; } | {<!-- -->!Promise<!-- --><<!-- -->!Target<!-- -->><!-- -->} |
|
||||
| options | { timeout?: number; } | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[Target](./puppeteer.target.md)<!-- -->>
|
||||
|
||||
{<!-- -->!Promise<!-- --><<!-- -->!Target<!-- -->><!-- -->}
|
||||
|
||||
|
@ -14,9 +14,11 @@ _getFolderPath(revision: string): string;
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| revision | string | {<!-- -->string<!-- -->} |
|
||||
| revision | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
string
|
||||
|
||||
{<!-- -->string<!-- -->}
|
||||
|
||||
|
@ -15,9 +15,11 @@ download(revision: string, progressCallback: (x: number, y: number) => void): Pr
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| revision | string | |
|
||||
| progressCallback | (x: number, y: number) => void | {<!-- -->!Promise<!-- --><<!-- -->!BrowserFetcher.RevisionInfo<!-- -->><!-- -->} |
|
||||
| progressCallback | (x: number, y: number) => void | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<BrowserFetcherRevisionInfo>
|
||||
|
||||
{<!-- -->!Promise<!-- --><<!-- -->!BrowserFetcher.RevisionInfo<!-- -->><!-- -->}
|
||||
|
||||
|
@ -14,9 +14,11 @@ createSession(targetInfo: Protocol.Target.TargetInfo): Promise<CDPSession>;
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| targetInfo | Protocol.Target.TargetInfo | {<!-- -->!Promise<!-- --><<!-- -->!CDPSession<!-- -->><!-- -->} |
|
||||
| targetInfo | Protocol.Target.TargetInfo | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[CDPSession](./puppeteer.cdpsession.md)<!-- -->>
|
||||
|
||||
{<!-- -->!Promise<!-- --><<!-- -->!CDPSession<!-- -->><!-- -->}
|
||||
|
||||
|
@ -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,8 +4,6 @@
|
||||
|
||||
## ElementHandle.boxModel() method
|
||||
|
||||
{<!-- -->!Promise<!-- --><<!-- -->?BoxModel<!-- -->><!-- -->}
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
@ -15,3 +13,5 @@ boxModel(): Promise<BoxModel | null>;
|
||||
|
||||
Promise<BoxModel \| null>
|
||||
|
||||
{<!-- -->!Promise<!-- --><<!-- -->?BoxModel<!-- -->><!-- -->}
|
||||
|
||||
|
@ -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<!-- --><<!-- -->?BoxModel<!-- -->><!-- -->} |
|
||||
| [boxModel()](./puppeteer.elementhandle.boxmodel.md) | | |
|
||||
| [click(options)](./puppeteer.elementhandle.click.md) | | |
|
||||
| [contentFrame()](./puppeteer.elementhandle.contentframe.md) | | |
|
||||
| [focus()](./puppeteer.elementhandle.focus.md) | | |
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
## HTTPRequest.failure() method
|
||||
|
||||
{<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->}
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
@ -17,3 +15,5 @@ failure(): {
|
||||
|
||||
{ errorText: string; } \| null
|
||||
|
||||
{<!-- -->?<!-- -->{<!-- -->errorText: string<!-- -->}<!-- -->}
|
||||
|
||||
|
@ -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) | | |
|
||||
|
@ -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,
|
||||
|
@ -84,7 +84,7 @@ function archiveName(
|
||||
* @param {string} platform
|
||||
* @param {string} host
|
||||
* @param {string} revision
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
function downloadURL(
|
||||
product: Product,
|
||||
@ -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,
|
||||
@ -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);
|
||||
@ -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,
|
||||
@ -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
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
@ -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
|
||||
@ -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,
|
||||
@ -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;
|
||||
|
@ -93,7 +93,7 @@ export class DOMWorld {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {!Promise<!ExecutionContext>}
|
||||
* @returns {!Promise<!ExecutionContext>}
|
||||
*/
|
||||
executionContext(): Promise<ExecutionContext> {
|
||||
if (this._detached)
|
||||
@ -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,
|
||||
@ -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,
|
||||
@ -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();
|
||||
@ -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();
|
||||
@ -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;
|
||||
@ -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,
|
||||
@ -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);
|
||||
|
@ -149,7 +149,7 @@ export class ExecutionContext {
|
||||
|
||||
/**
|
||||
* @param {*} arg
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
* @this {ExecutionContext}
|
||||
*/
|
||||
function convertArgument(this: ExecutionContext, arg: unknown): unknown {
|
||||
|
@ -102,7 +102,7 @@ export class HTTPRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {?{errorText: string}}
|
||||
* @returns {?{errorText: string}}
|
||||
*/
|
||||
failure(): { errorText: string } | null {
|
||||
if (!this._failureText) return null;
|
||||
|
@ -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();
|
||||
|
@ -154,7 +154,7 @@ class ChromeLauncher implements ProductLauncher {
|
||||
|
||||
/**
|
||||
* @param {!Launcher.ChromeArgOptions=} options
|
||||
* @return {!Array<string>}
|
||||
* @returns {!Array<string>}
|
||||
*/
|
||||
defaultArgs(options: ChromeArgOptions = {}): string[] {
|
||||
const chromeArguments = [
|
||||
|
@ -212,7 +212,7 @@ export class LifecycleWatcher {
|
||||
/**
|
||||
* @param {!Frame} frame
|
||||
* @param {!Array<string>} expectedLifecycle
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function checkLifecycle(
|
||||
frame: Frame,
|
||||
|
@ -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))
|
||||
@ -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')
|
||||
@ -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);
|
||||
@ -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);
|
||||
|
@ -693,7 +693,7 @@ describe('request interception', function () {
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
function pathToFileURL(path) {
|
||||
let pathName = path.replace(/\\/g, '/');
|
||||
|
@ -42,7 +42,7 @@ const utils = (module.exports = {
|
||||
},
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
projectRoot: function () {
|
||||
return PROJECT_ROOT;
|
||||
@ -52,7 +52,7 @@ const utils = (module.exports = {
|
||||
* @param {!Page} page
|
||||
* @param {string} frameId
|
||||
* @param {string} url
|
||||
* @return {!Frame}
|
||||
* @returns {!Frame}
|
||||
*/
|
||||
attachFrame: async function (page, frameId, url) {
|
||||
const handle = await page.evaluateHandle(attachFrame, frameId, url);
|
||||
@ -103,7 +103,7 @@ const utils = (module.exports = {
|
||||
/**
|
||||
* @param {!Frame} frame
|
||||
* @param {string=} indentation
|
||||
* @return {Array<string>}
|
||||
* @returns {Array<string>}
|
||||
*/
|
||||
dumpFrames: function (frame, indentation) {
|
||||
indentation = indentation || '';
|
||||
@ -118,7 +118,7 @@ const utils = (module.exports = {
|
||||
/**
|
||||
* @param {!EventEmitter} emitter
|
||||
* @param {string} eventName
|
||||
* @return {!Promise<!Object>}
|
||||
* @returns {!Promise<!Object>}
|
||||
*/
|
||||
waitEvent: function (emitter, eventName, predicate = () => true) {
|
||||
return new Promise((fulfill) => {
|
||||
|
@ -203,7 +203,7 @@ async function checkRangeAvailability({
|
||||
* @param {!Table} table
|
||||
* @param {string} name
|
||||
* @param {number} revision
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
async function checkAndDrawRevisionAvailability(table, name, revision) {
|
||||
const promises = fetchers.map((fetcher) => fetcher.canDownload(revision));
|
||||
@ -225,7 +225,7 @@ async function checkAndDrawRevisionAvailability(table, name, revision) {
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @return {!Promise<?string>}
|
||||
* @returns {!Promise<?string>}
|
||||
*/
|
||||
function fetch(url) {
|
||||
let resolve;
|
||||
@ -253,7 +253,7 @@ function fetch(url) {
|
||||
|
||||
/**
|
||||
* @param {number} size
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
function spaceString(size) {
|
||||
return new Array(size).fill(' ').join('');
|
||||
@ -261,7 +261,7 @@ function spaceString(size) {
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
function filterOutColors(text) {
|
||||
for (const colorName in colors) {
|
||||
@ -274,7 +274,7 @@ function filterOutColors(text) {
|
||||
/**
|
||||
* @param {string} text
|
||||
* @param {number} length
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
function padCenter(text, length) {
|
||||
const printableCharacters = filterOutColors(text);
|
||||
|
@ -26,7 +26,7 @@ class Message {
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @return {!Message}
|
||||
* @returns {!Message}
|
||||
*/
|
||||
static error(text) {
|
||||
return new Message('error', text);
|
||||
@ -34,7 +34,7 @@ class Message {
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @return {!Message}
|
||||
* @returns {!Message}
|
||||
*/
|
||||
static warning(text) {
|
||||
return new Message('warning', text);
|
||||
|
@ -38,21 +38,21 @@ class Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
filePath() {
|
||||
return this._filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
projectPath() {
|
||||
return this._projectPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
name() {
|
||||
return this._name;
|
||||
@ -60,7 +60,7 @@ class Source {
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
setText(text) {
|
||||
if (text === this._text) return false;
|
||||
@ -70,14 +70,14 @@ class Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
text() {
|
||||
return this._text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
hasUpdatedText() {
|
||||
return this._hasUpdatedText;
|
||||
@ -89,7 +89,7 @@ class Source {
|
||||
|
||||
/**
|
||||
* @param {string} filePath
|
||||
* @return {!Promise<Source>}
|
||||
* @returns {!Promise<Source>}
|
||||
*/
|
||||
static async readFile(filePath) {
|
||||
filePath = path.resolve(filePath);
|
||||
@ -100,7 +100,7 @@ class Source {
|
||||
/**
|
||||
* @param {string} dirPath
|
||||
* @param {string=} extension
|
||||
* @return {!Promise<!Array<!Source>>}
|
||||
* @returns {!Promise<!Array<!Source>>}
|
||||
*/
|
||||
static async readdir(dirPath, extension = '') {
|
||||
const fileNames = await readdirAsync(dirPath);
|
||||
|
@ -100,7 +100,7 @@ Documentation.Member = class {
|
||||
* @param {string} name
|
||||
* @param {!Array<!Documentation.Member>} argsArray
|
||||
* @param {?Documentation.Type} returnType
|
||||
* @return {!Documentation.Member}
|
||||
* @returns {!Documentation.Member}
|
||||
*/
|
||||
static createMethod(name, argsArray, returnType, returnComment, comment) {
|
||||
return new Documentation.Member(
|
||||
@ -118,7 +118,7 @@ Documentation.Member = class {
|
||||
* @param {!Documentation.Type} type
|
||||
* @param {string=} comment
|
||||
* @param {boolean=} required
|
||||
* @return {!Documentation.Member}
|
||||
* @returns {!Documentation.Member}
|
||||
*/
|
||||
static createProperty(name, type, comment, required) {
|
||||
return new Documentation.Member(
|
||||
@ -136,7 +136,7 @@ Documentation.Member = class {
|
||||
* @param {string} name
|
||||
* @param {?Documentation.Type=} type
|
||||
* @param {string=} comment
|
||||
* @return {!Documentation.Member}
|
||||
* @returns {!Documentation.Member}
|
||||
*/
|
||||
static createEvent(name, type = null, comment) {
|
||||
return new Documentation.Member('event', name, type, [], comment);
|
||||
|
@ -68,7 +68,7 @@ function checkSources(sources) {
|
||||
/**
|
||||
* @param {!Array<!Documentation.Class>} classes
|
||||
* @param {!Map<string, string>} inheritance
|
||||
* @return {!Array<!Documentation.Class>}
|
||||
* @returns {!Array<!Documentation.Class>}
|
||||
*/
|
||||
function recreateClassesWithInheritance(classes, inheritance) {
|
||||
const classesByName = new Map(classes.map((cls) => [cls.name, cls]));
|
||||
@ -155,7 +155,7 @@ function checkSources(sources) {
|
||||
|
||||
/**
|
||||
* @param {!ts.Type} type
|
||||
* @return {!Documentation.Type}
|
||||
* @returns {!Documentation.Type}
|
||||
*/
|
||||
function serializeType(type, circular = []) {
|
||||
let typeName = checker.typeToString(type);
|
||||
@ -207,7 +207,7 @@ function checkSources(sources) {
|
||||
|
||||
/**
|
||||
* @param {!ts.Symbol} symbol
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function symbolHasPrivateModifier(symbol) {
|
||||
const modifiers =
|
||||
@ -220,7 +220,7 @@ function checkSources(sources) {
|
||||
/**
|
||||
* @param {string} className
|
||||
* @param {!ts.Symbol} symbol
|
||||
* @return {}
|
||||
* @returns {}
|
||||
*/
|
||||
function serializeClass(className, symbol, node) {
|
||||
/** @type {!Array<!Documentation.Member>} */
|
||||
|
@ -21,7 +21,7 @@ class MDOutline {
|
||||
/**
|
||||
* @param {!Page} page
|
||||
* @param {string} text
|
||||
* @return {!MDOutline}
|
||||
* @returns {!MDOutline}
|
||||
*/
|
||||
static async create(page, text) {
|
||||
// Render markdown as HTML.
|
||||
@ -86,7 +86,7 @@ class MDOutline {
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
* @returns {string}
|
||||
*/
|
||||
function findType(str) {
|
||||
const start = str.indexOf('<') + 1;
|
||||
@ -227,7 +227,7 @@ class MDOutline {
|
||||
/**
|
||||
* @param {!Node} fromInclusive
|
||||
* @param {!Node} toExclusive
|
||||
* @return {!DocumentFragment}
|
||||
* @returns {!DocumentFragment}
|
||||
*/
|
||||
function extractSiblingsIntoFragment(fromInclusive, toExclusive) {
|
||||
const fragment = document.createDocumentFragment();
|
||||
@ -387,7 +387,7 @@ class MDOutline {
|
||||
/**
|
||||
* @param {!Page} page
|
||||
* @param {!Array<!Source>} sources
|
||||
* @return {!Promise<{documentation: !Documentation, errors: !Array<string>}>}
|
||||
* @returns {!Promise<{documentation: !Documentation, errors: !Array<string>}>}
|
||||
*/
|
||||
module.exports = async function (page, sources) {
|
||||
const classes = [];
|
||||
|
@ -30,7 +30,7 @@ const EXCLUDE_PROPERTIES = new Set([
|
||||
/**
|
||||
* @param {!Page} page
|
||||
* @param {!Array<!Source>} mdSources
|
||||
* @return {!Promise<!Array<!Message>>}
|
||||
* @returns {!Promise<!Array<!Message>>}
|
||||
*/
|
||||
module.exports = async function lint(page, mdSources, jsSources) {
|
||||
const mdResult = await mdBuilder(page, mdSources);
|
||||
@ -57,7 +57,7 @@ module.exports = async function lint(page, mdSources, jsSources) {
|
||||
|
||||
/**
|
||||
* @param {!Documentation} doc
|
||||
* @return {!Array<string>}
|
||||
* @returns {!Array<string>}
|
||||
*/
|
||||
function checkSorting(doc) {
|
||||
const errors = [];
|
||||
@ -122,7 +122,7 @@ function checkSorting(doc) {
|
||||
/**
|
||||
* @param {!Array<!Source>} jsSources
|
||||
* @param {!Documentation} jsDocumentation
|
||||
* @return {!Documentation}
|
||||
* @returns {!Documentation}
|
||||
*/
|
||||
function filterJSDocumentation(jsSources, jsDocumentation) {
|
||||
const apijs = jsSources.find((source) => source.name() === 'api.js');
|
||||
@ -142,7 +142,7 @@ function filterJSDocumentation(jsSources, jsDocumentation) {
|
||||
|
||||
/**
|
||||
* @param {!Documentation} doc
|
||||
* @return {!Array<string>}
|
||||
* @returns {!Array<string>}
|
||||
*/
|
||||
function checkDuplicates(doc) {
|
||||
const errors = [];
|
||||
@ -183,7 +183,7 @@ const expectedNonExistingMethods = new Map([
|
||||
/**
|
||||
* @param {!Documentation} actual
|
||||
* @param {!Documentation} expected
|
||||
* @return {!Array<string>}
|
||||
* @returns {!Array<string>}
|
||||
*/
|
||||
function compareDocumentations(actual, expected) {
|
||||
const errors = [];
|
||||
@ -684,7 +684,7 @@ function compareDocumentations(actual, expected) {
|
||||
/**
|
||||
* @param {!Array<string>} actual
|
||||
* @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) {
|
||||
const N = actual.length;
|
||||
|
@ -89,7 +89,7 @@ module.exports.runCommands = function (sources, version) {
|
||||
/**
|
||||
* @param {{name: string, from: number, to: number, source: !Source}} command
|
||||
* @param {string} editText
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function applyCommand(command, editText) {
|
||||
const text = command.source.text();
|
||||
|
@ -123,7 +123,7 @@ async function main(url) {
|
||||
* @param {string} deviceName
|
||||
* @param {*} descriptor
|
||||
* @param {boolean} landscape
|
||||
* @return {!Object}
|
||||
* @returns {!Object}
|
||||
*/
|
||||
function createDevice(chromeVersion, deviceName, descriptor, landscape) {
|
||||
const devicePayload = loadFromJSONV1(descriptor);
|
||||
@ -148,7 +148,7 @@ function createDevice(chromeVersion, deviceName, descriptor, landscape) {
|
||||
|
||||
/**
|
||||
* @param {*} json
|
||||
* @return {?Object}
|
||||
* @returns {?Object}
|
||||
*/
|
||||
function loadFromJSONV1(json) {
|
||||
/**
|
||||
@ -156,7 +156,7 @@ function loadFromJSONV1(json) {
|
||||
* @param {string} key
|
||||
* @param {string} type
|
||||
* @param {*=} defaultValue
|
||||
* @return {*}
|
||||
* @returns {*}
|
||||
*/
|
||||
function parseValue(object, key, type, defaultValue) {
|
||||
if (
|
||||
@ -184,7 +184,7 @@ function loadFromJSONV1(json) {
|
||||
/**
|
||||
* @param {*} object
|
||||
* @param {string} key
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
function parseIntValue(object, key) {
|
||||
const value = /** @type {number} */ (parseValue(object, key, 'number'));
|
||||
@ -195,7 +195,7 @@ function loadFromJSONV1(json) {
|
||||
|
||||
/**
|
||||
* @param {*} json
|
||||
* @return {!{width: number, height: number}}
|
||||
* @returns {!{width: number, height: number}}
|
||||
*/
|
||||
function parseOrientation(json) {
|
||||
const result = {};
|
||||
@ -259,7 +259,7 @@ function loadFromJSONV1(json) {
|
||||
|
||||
/**
|
||||
* @param {url}
|
||||
* @return {!Promise}
|
||||
* @returns {!Promise}
|
||||
*/
|
||||
function httpGET(url) {
|
||||
let fulfill, reject;
|
||||
|
@ -29,7 +29,7 @@ class TestServer {
|
||||
/**
|
||||
* @param {string} dirPath
|
||||
* @param {number} port
|
||||
* @return {!TestServer}
|
||||
* @returns {!TestServer}
|
||||
*/
|
||||
static async create(dirPath, port) {
|
||||
const server = new TestServer(dirPath, port);
|
||||
@ -40,7 +40,7 @@ class TestServer {
|
||||
/**
|
||||
* @param {string} dirPath
|
||||
* @param {number} port
|
||||
* @return {!TestServer}
|
||||
* @returns {!TestServer}
|
||||
*/
|
||||
static async createHTTPS(dirPath, port) {
|
||||
const server = new TestServer(dirPath, port, {
|
||||
@ -151,7 +151,7 @@ class TestServer {
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @return {!Promise<!IncomingMessage>}
|
||||
* @returns {!Promise<!IncomingMessage>}
|
||||
*/
|
||||
waitForRequest(path) {
|
||||
let promise = this._requestSubscribers.get(path);
|
||||
|
Loading…
Reference in New Issue
Block a user