Skip to content

Types with same name but different type parameters #3478

Closed
@mariusschulz

Description

@mariusschulz

I was wondering: Are there any plans to support multiple types with the same name, but with a different number of type parameters, like this (similar to the Func<T> type in C#)?

interface Func<TResult> {
    (): TResult;
}

interface Func<T1, TResult> {
    (value: T1): TResult;
}

// ...

The current error message says that "all declarations of an interface must have identical type parameters".

Or, with #1616:

type Func<TResult> = () => TResult;
type Func<T1, TResult> = (value: T1) => TResult;

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions