Skip to content

Extended type parameters don't work as constraints with overloads #7378

Closed
@falsandtru

Description

@falsandtru

TypeScript Version:

master

Code

interface I {
  toString(): number;
}
function f<T extends number>(p: void) // should be an error
function f<T extends number>(p: number)
function f<T extends number>(p: string) // should be an error
function f<T extends number>(p: I) // should be an error
function f<T extends number>(p: T) { }

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it adds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions