Skip to content

Wrong checking return type from function #31235

Closed
@snatvb

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 }
}

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