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

Suggestion: Display a honest message when inference cannot be done correctly #3055

Description

Currently (TS v.1.5.2) the compiler does not do inference correctly for certain cases:

#3038

Although it is by design, reflected in the spec and there is no viable way for doing it correctly, I think the compiler has to be honest to the developer and instead of generating faulty code, it has to break with an error message that would say that the inferred types cannot be resolved.

Activity

  1. RyanCavanaugh commented on May 6, 2015

    @RyanCavanaugh
    Member

    This would be throwing a lot of babies out with very little bathwater. There is tons of code that hits that part of the spec where the types are correct and it would be counterproductive to issue an error in those cases.

  2. zpdDG4gta8XKpMCd commented on May 6, 2015

    @zpdDG4gta8XKpMCd
    Author

    For those parts that are correct no errors are necessary, for other parts that cannot be resolved properly such issue would be very much appreciated. Is there a problem with detecting what can and what cannot be inferred ahead, so that both correct cases with generated code and incorrect ones with error messages are properly covered?

  3. RyanCavanaugh commented on May 6, 2015

    @RyanCavanaugh
    Member

    The entire problem is that we don't have an algorithm for determining what's an error and what isn't.

    We didn't have that capability and then randomly decide to not issue errors in some cases, of course.

  4. zpdDG4gta8XKpMCd commented on May 6, 2015

    @zpdDG4gta8XKpMCd
    Author

    So we might want to keep this issue open please, don't we? It is certainly a problem that the compiler doesn't work property and it deserves some attention from the community. There are a lot of open requests that ask for much sillier features than this one and yet they don't get closed.

  5. JsonFreeman commented on May 7, 2015

    @JsonFreeman
    Contributor

    This is a duplicate of #3038.

  6. 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

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadDuplicateAn 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