Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: nit type validator fix (#4830)

Pavel Feldmanfee7dd7cc11f
diff --git a/utils/doclint/check_public_api/JSBuilder.js b/utils/doclint/check_public_api/JSBuilder.js
index 5cd6e4d0dd..d83b65c979 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<void>' : 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 2cd2103939..6b71bf73d1 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\<Element\>/g, 'ElementHandle'],
- [/ElementHandle\<Node\>/g, 'ElementHandle'],
- [/ElementHandle\<T\>/g, 'ElementHandle'],
- [/Handle\<R\>/g, 'JSHandle'],
- [/JSHandle\<Object\>/g, 'JSHandle'],
+ [/Arg/g, 'Object'],
+ [/ChromiumBrowserContext/g, 'BrowserContext'],
+ [/ElementHandle<[^>]+>/g, 'ElementHandle'],
+ [/Handle<R>/g, 'JSHandle'],
+ [/JSHandle<Object>/g, 'JSHandle'],
[/object/g, 'Object'],
- [/Promise\<T\>/, 'Promise<Object>'],
+ [/Promise<T>/, 'Promise<Object>'],
[/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 40e9475b02..09856293db 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<void>"
},
"kind": "method",
"args": [