diff --git a/src/loader/babel.ts b/src/loader/babel.ts index fec6e33..eaf1c38 100644 --- a/src/loader/babel.ts +++ b/src/loader/babel.ts @@ -111,7 +111,7 @@ export default function babelPluginUntyped (api: ConfigAPI) { // Extract and apply any manual types schema.tags = schema.tags?.filter((tag) => { if (tag.startsWith('@returns')) { - const { type } = tag.match(/^@returns\s+\{(?[^}]+)\}/)?.groups || {} + const { type } = tag.match(/^@returns\s+\{(?.+)\}/)?.groups || {} if (type) { schema.returns = schema.returns || {} Object.assign(schema.returns, getTypeDescriptor(type)) @@ -119,7 +119,7 @@ export default function babelPluginUntyped (api: ConfigAPI) { } } if (tag.startsWith('@param')) { - const { type, param } = tag.match(/^@param\s+\{(?[^}]+)\}\s+(?\w+)/)?.groups || {} + const { type, param } = tag.match(/^@param\s+\{(?.+)\}\s+(?\w+)/)?.groups || {} if (type && param) { const arg = schema.args?.find(arg => arg.name === param) if (arg) { @@ -188,12 +188,12 @@ function parseJSDocs (input: string | string[]): Schema { const tags = clumpLines(lines.slice(firstTag), ['@'], '\n') for (const tag of tags) { if (tag.startsWith('@type')) { - const type = tag.match(/@type\s+\{([^}]+)\}/)?.[1] + const type = tag.match(/@type\s+\{(.+)\}/)?.[1] Object.assign(schema, getTypeDescriptor(type)) - const typedef = tags.find(t => t.match(/@typedef\s+\{([^}]+)\} (.*)/)?.[2] === type) + const typedef = tags.find(t => t.match(/@typedef\s+\{(.+)\} (.*)/)?.[2] === type) if (typedef) { schema.markdownType = type - schema.tsType = typedef.match(/@typedef\s+\{([^}]+)\}/)?.[1] + schema.tsType = typedef.match(/@typedef\s+\{(.+)\}/)?.[1] } continue }