Skip to content

[Suggestion] should Overloads not differ only by return type? #11281

Closed

Description

I wonder if this is a bug. But at least this is a discrepancy between specification and implementation.

It appears in TS 1.03 function overloading cannot differ only by return type, but in TS1.1 this restriction was lifted.

function a(): number
function a(): string
function a(): any { return null as any}

SO question: http://stackoverflow.com/questions/25022331/overloads-cannot-differ-only-by-return-type

Source: https://github.com/Microsoft/TypeScript/blob/release-1.0.3/src/compiler/resources/diagnosticMessages.json#L1024

Spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#1212-ambient-function-declarations

This should also impact call signatures in intersection types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn idea for TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions