Skip to content

Commit

Permalink
chore: nit type validator fix (#4830)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman committed Dec 27, 2020
1 parent 905f28c commit fee7dd7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion utils/doclint/check_public_api/JSBuilder.js
Expand Up @@ -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, []);
Expand Down
15 changes: 9 additions & 6 deletions utils/doclint/check_public_api/index.js
Expand Up @@ -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;
Expand Down Expand Up @@ -317,6 +318,8 @@ function normalizeType(type) {
word += c;
}
}
if (word)
result.push(word);
result.sort();
return result.join('|');
}
Expand Up @@ -24,7 +24,7 @@
{
"name": "method",
"type": {
"name": "Promise"
"name": "Promise<void>"
},
"kind": "method",
"args": [
Expand Down

0 comments on commit fee7dd7

Please sign in to comment.