diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/apidoc/signature.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 704c4dad..154d1c72 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -301,14 +301,17 @@ function extractDefaultFromComment(comment?: Comment): string { if (!comment) { return; } - const text = comment.shortText; - if (!text || text.trim() === '') { + const text = comment.shortText?.trim(); + if (!text) { return; } - const result = /(.*)[ \n]Defaults to `([^`]+)`./.exec(text); + const result = /^(.*)[ \n]Defaults to `([^`]+)`\.(.*)$/s.exec(text); if (!result) { return; } + if (result[3].trim()) { + throw new Error(`Found description text after the default value:\n${text}`); + } comment.shortText = result[1]; return result[2]; } |
