Skip to content

Add assertions when implicitly returning from a function #2

Description

@phpnode

Issuehunt badges

Currently if a function implicitly returns undefined (by leaving the function without an explicit return statement) we won't generate a check for it, e.g:

function foo (): string {
  // no return
}

currently compiles to:

function foo () {
  const _returnType = t.return(t.string()); 
  // no return
}

We should insert a call to _returnType.assert(undefined) at these points.


IssueHunt Summary

Backers (Total: $20.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions