Skip to content

Validate returned value usage for functions not annotated with @return #466

@crdev

Description

@crdev

Here's the case:

function foo()
{
  // do something
  // do not return any value
}

function bar()
{
  console.log(1 + foo());
}

In this case, the foo() function has no @return annotation, since it does not return anything. However, it used to @return {number}, and bar() contains code relying on this. Now that foo() has been modified to not return anything, the compiler considers its return type as ? (unchecked), and hence does not detect the error in bar().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions