diff --git a/utils/doclint/check_public_api/JSBuilder.js b/utils/doclint/check_public_api/JSBuilder.js index 5cd6e4d0dd0ef..d83b65c97972c 100644 --- a/utils/doclint/check_public_api/JSBuilder.js +++ b/utils/doclint/check_public_api/JSBuilder.js @@ -219,7 +219,7 @@ function checkSources(sources) { innerTypeNames.push(innerType.name); } if (innerTypeNames.length === 0 || (innerTypeNames.length === 1 && innerTypeNames[0] === 'void')) - return new Documentation.Type(type.symbol.name); + return new Documentation.Type(type.symbol.name === 'Promise' ? 'Promise' : type.symbol.name); return new Documentation.Type(`${type.symbol.name}<${innerTypeNames.join(', ')}>`, properties); } return new Documentation.Type(typeName, []); diff --git a/utils/doclint/check_public_api/index.js b/utils/doclint/check_public_api/index.js index 2cd21039393db..6b71bf73d1d2f 100644 --- a/utils/doclint/check_public_api/index.js +++ b/utils/doclint/check_public_api/index.js @@ -191,16 +191,17 @@ function compareDocumentations(actual, expected) { [/\ /g, ''], // We shortcut ? to null| [/\?/g, 'null|'], + [/EvaluationArgument/g, 'Object'], ]; const tsReplacers = [ [/\ /g, ''], - [/ElementHandle\/g, 'ElementHandle'], - [/ElementHandle\/g, 'ElementHandle'], - [/ElementHandle\/g, 'ElementHandle'], - [/Handle\/g, 'JSHandle'], - [/JSHandle\/g, 'JSHandle'], + [/Arg/g, 'Object'], + [/ChromiumBrowserContext/g, 'BrowserContext'], + [/ElementHandle<[^>]+>/g, 'ElementHandle'], + [/Handle/g, 'JSHandle'], + [/JSHandle/g, 'JSHandle'], [/object/g, 'Object'], - [/Promise\/, 'Promise'], + [/Promise/, 'Promise'], [/TextendsNode\?ElementHandle:null/, 'null|ElementHandle'] ] let actualName = actual.name; @@ -317,6 +318,8 @@ function normalizeType(type) { word += c; } } + if (word) + result.push(word); result.sort(); return result.join('|'); } diff --git a/utils/doclint/check_public_api/test/js-builder-common/result.txt b/utils/doclint/check_public_api/test/js-builder-common/result.txt index 40e9475b020b0..09856293db8a4 100644 --- a/utils/doclint/check_public_api/test/js-builder-common/result.txt +++ b/utils/doclint/check_public_api/test/js-builder-common/result.txt @@ -24,7 +24,7 @@ { "name": "method", "type": { - "name": "Promise" + "name": "Promise" }, "kind": "method", "args": [