Skip to content

Consider removing special checks for specialized signatures with other overloads #6143

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Specialized signatures needing to be compatible with an overload was an artificial requirement due to issues in #943. Now that we've fixed that, we should consider what we're going to do with this rule.

Could we remove it wholesale? That would potentially be a breaking change, but it seems like good one. Basically, the situations you'd run into this would be where you have something like the following...

function doThing(x: "dog"): Dog;
function doThing(x: "cat"): Cat;
function doThing(x: string): Animal;
function doThing(x: string, y?: string): Moose {
}

Where now we'd check if the implementation was assignable to the specialized signatures and give an error. That seems like a good change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeWould introduce errors in existing codeCommittedThe team has roadmapped this issueDomain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedFixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions