Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow inference of some type parameters #7351

Closed
chadaustin opened this issue Mar 2, 2016 · 3 comments
Closed

Allow inference of some type parameters #7351

chadaustin opened this issue Mar 2, 2016 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@chadaustin
Copy link

TypeScript Version: 1.8.7

Code

function make_component<A, B extends A>(arg: () => B) {
}

h<{x: string}>(() => {
    return {
        x: "hello",
        y: 10,
    };
});

I have a function that produces a higher-order react component by taking a function that knows how to take a set of "external props", run a function taking the external props returning "computed props". The union of the external props and the computed props is a set of "internal props", which the internal React component can rely on.

I want the caller to specify just one of these property sets, and have everything else be inferred by the function argument passed in. The code above is a simplified example of this.

Note that only one type parameter is specified -- I would hope the second could be inferred by the function argument (like C++).

However, instead I get a "Supplied parameters do not match any signature of call target." error.

@RyanCavanaugh
Copy link
Member

I believe this is just #7234 ?

@chadaustin
Copy link
Author

Ah, that looks the same. We could close as a duplicate of #7234 and test again once it's fixed.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 3, 2016
@RyanCavanaugh
Copy link
Member

Sounds good, thanks!

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants