镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Generics return type check with arrow functions #13631

Description

@zerkms

TypeScript Version: playground (2.1.4-insiders.20161201)

Code

let f1: <T>(a: T) => T = a => 42;

function f2<T>(a: T): T {
    return 42;
};

Expected behavior:

Since those functions are identical I expect both to behave the same: to fail the type check.

Actual behavior:

The f1 type checks fine.

Activity

  1. mhegazy commented on May 18, 2017

    @mhegazy
    Contributor

    Duplicate of #5616

  2. locked and limited conversation to collaborators on Jun 19, 2018
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 created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions