mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: nit type validator fix (#4830)
This commit is contained in:
parent
905f28c339
commit
fee7dd7cc1
@ -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, []);
|
||||
|
@ -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('|');
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
{
|
||||
"name": "method",
|
||||
"type": {
|
||||
"name": "Promise"
|
||||
"name": "Promise<void>"
|
||||
},
|
||||
"kind": "method",
|
||||
"args": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user