From 8709a3a24b22304a2be67ac5688a998e71a32c5e Mon Sep 17 00:00:00 2001 From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com> Date: Tue, 27 Feb 2024 07:52:29 -0800 Subject: [PATCH] cherry-pick(#29687): chore: fix docs roll for functions without args follow-up (#29688) This PR cherry-picks the following commits: - 03902d8e85056ad630441be42a0e518086d685da - 1a43adc50655360fcd18484a2a238e8fe8c03421 --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- utils/doclint/documentation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/doclint/documentation.js b/utils/doclint/documentation.js index de35df27ba424..f0527c412053d 100644 --- a/utils/doclint/documentation.js +++ b/utils/doclint/documentation.js @@ -566,7 +566,7 @@ class Type { return type; } - if (parsedType.args) { + if (parsedType.args || parsedType.retType) { const type = new Type('function'); type.args = []; // @ts-ignore @@ -737,7 +737,8 @@ function parseTypeExpression(type) { if (type[i] === '(') { name = type.substring(0, i); const matching = matchingBracket(type.substring(i), '(', ')'); - args = parseTypeExpression(type.substring(i + 1, i + matching - 1)); + const argsString = type.substring(i + 1, i + matching - 1); + args = argsString ? parseTypeExpression(argsString) : null; i = i + matching; if (type[i] === ':') { retType = parseTypeExpression(type.substring(i + 1));