Skip to content

Wrong checking return type from function #31235

Closed

Description

@snatvb
type A = {
  a: boolean;
}
type B = (v: A) => A

const c: B = (a) => {
  return { a: true, asd: 235 }
}

Why I don't have error?

But if I will write such code, then I get error:

const f = (v: A): A => {
  return { a: true, asd: 235 }
}

Activity

  1. jack-williams commented on May 3, 2019

    @jack-williams
    Collaborator

    Duplicate of #241/#29390/#30198. (The first issue might not look immediately related but it's the root cause).

  2. snatvb commented on May 6, 2019

    @snatvb
    Author

    Jack Williams (@jack-williams) how i understand, this problem will not be solved, becouse first post was in 2014, right?

  3. typescript-bot commented on May 8, 2019

    @typescript-bot
    Contributor

    This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

  4. locked as resolved and limited conversation to collaborators on Oct 21, 2025
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

    DuplicateAn existing issue was already createdFix AvailableA PR has been opened for this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions