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

Simpler type annotation #17366

Closed
ivan-demchenko opened this issue Jul 24, 2017 · 2 comments
Closed

Simpler type annotation #17366

ivan-demchenko opened this issue Jul 24, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@ivan-demchenko
Copy link

Summary

Sometimes, we have to specify arguments to functions that are not really needed. For example, in function intefaces.

Actual

As a dummy example, consider this snippet:

interface Functor<A> {
    fmap<B>(f: (x: A) => B): Functor<B>
}

interface MyFnInterface1<B, C> {
    (x: B, y: B): Promise<C>
}

interface MyFnInterface2<B, C> {
    (fn: (x: B, y: B) => C): Promise<C>
}

Would be nice to have

The snippet above could be simplified as the following:

interface Functor<A> {
    fmap<B>((A) => B): Functor<B>
}

interface MyFnInterface1<B, C> {
    (B, B): Promise<C>
}

interface MyFnInterface2<B, C> {
    ((B, B) => C): Promise<C>
    ((B) => (B) => C): Promise<C>
}

or, even to this:

interface Functor<A> {
    fmap<B>(A => B): Functor<B>
}

interface MyFnInterface1<B, C> {
    (B, B): Promise<C>
}

interface MyFnInterface2<B, C> {
    ((B, B) => C): Promise<C>
    (B => B => C): Promise<C>
}
@gcnew
Copy link
Contributor

gcnew commented Jul 24, 2017

It has already been suggested numerous times. See #13152

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jul 24, 2017
@RyanCavanaugh
Copy link
Member

Duplicate of #3081

@RyanCavanaugh RyanCavanaugh marked this as a duplicate of #3081 Jul 24, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 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

3 participants