Skip to content

Infer type for generic. #5652

Closed
Closed
@Strate

Description

@Strate

Hi!

Seems that some cases of inferring types does not work:

interface Blabla<T> {
    (): T
}

function some(): Blabla {
    return () => {
        return 123;
    }
}

I got compilation error:

error TS2314: Generic type 'Blabla<T>' requires 1 type argument(s).

Is it possible to infer number type for T?

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions