Skip to content

Contextual typing of object literal methods not working for return expressions #1610

Closed

Description

interface I {
    x(): (p: number) => void;
}

var obj: I = {
    x() {
        return q => { };
    }
}

q has type any, but should be number.

Activity

  1. modified the milestones: , TypeScript 2.0 on Apr 20, 2015
  2. DanielRosenwasser commented on Jun 19, 2015

    @DanielRosenwasser
    Member

    Just to reiterate on the conversation in #3570, the spec may need to be amended to reflect this.

  3. added
    FixedA PR has been merged for this issue
    BugA bug in TypeScript
    and removed
    SuggestionAn idea for TypeScript
    on Jul 27, 2015
  4. locked and limited conversation to collaborators on Jun 18, 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

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions