Skip to content

Orphan tag error with empty @returns jsdocs on 6.6.0 #1741

Description

@sinomsinom

Sorting

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

/**
* @returns
*/
@Get()
public async testEndpoint(
    @Body()
    test: {test:string}
): Promise<number>
{
    return 1.5
}

and

/**
* @returns {Promise<number>}
*/
@Get()
public async testEndpoint(
    @Body()
    test: {test:string}
): Promise<number>
{
    return 1.5
}

should be usable without errors on generate

Current Behavior

Tsoa throws the following error when trying to spec-and-routes:

 in 'Controller.test'
    at <path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\methodGenerator.js:114:23
    at Array.map (<anonymous>)
    at MethodGenerator.buildParameters (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\methodGenerator.js:106:14)
    at MethodGenerator.Generate (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\methodGenerator.js:76:33)
    at <path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\controllerGenerator.js:46:41
    at Array.map (<anonymous>)
    at ControllerGenerator.buildMethods (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\controllerGenerator.js:46:14)
    at ControllerGenerator.Generate (<path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\controllerGenerator.js:35:27)
    at <path-to-project>\node_modules\@tsoa\cli\dist\metadataGeneration\metadataGenerator.js:210:41
    at Array.map (<anonymous>)

Steps to Reproduce

Add a @returns jsdocs comment to any endpoint without adding a comment after it, either leaving it blank or only adding a type in curly braces

Context (Environment)

Version of the library: v6.6.0
Version of NodeJS: v22.12.0

  • Confirm you were using yarn not npm: [X]

Detailed Description

After upgrading from 6.5.1 to 6.6.0 empty or type only @returns tags started throwing errors when generating.
This error doesn't happen if there are no parameter tags (like the @Body tag in the example).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueThis issue could be an easy PR for those looking to help contributehelp wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions