-
Notifications
You must be signed in to change notification settings - Fork 38
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
Should we have this? #68
Comments
Cool. Looking over a few of their examples, they make a good case ( Want to write up a few example use cases? |
It's not a rhetorical question. This one is out of my league. |
Yes, we should. Things that should be considered:
Ps: I just quickly scaned the TypeScript discussion yet. |
@maiermic In most cases, |
@ericelliott Who is the user of |
What he's saying is that, unless you have a way to declare the executing context, That's why it's only useful—without any prior context setting—when the function doesn't expect something in particular. |
In a lot of languages |
I am closing this for now and moving it to the backlog: it's not essential for the MVP. |
Any example of a language with type annotations where |
I am gonna re-introduce the problem at hand for the ones dropping by. The main use case that we need to cover is—as explained by @ericelliott before—being able to restrict the type of "the call-site". Now here's my take on this (pun intended), I think it would make sense to place it just before the function signature. e.g. If we really want to make it obvious we could reuse something recognizable by any JS dev:
I don't particularly support this proposal. The priority for me is the position/order.
|
The
|
I forgot about that proposal but now that you remind me I did participate in tc39/proposal-bind-operator#24 I like your example, it's simple and it's reusing a reserved type that has already been defined, much clearer than mine. The problem will be the error case. The way it will be handled is tool-dependent hence off-topic in the rtype specification. |
I am leaning toward A. Both is also a valid option.
If so, shouldn't it be recommended? |
I think you're misunderstanding the second syntax. In the TC39 proposal, the I'm not sure how we'd use that in Rtype. |
Are you telling me that https://babeljs.io/docs/plugins/transform-function-bind/#detail is erroneous? |
OK, but not sure how that makes sense. ::obj.func(val)
// is equivalent to:
func.call(obj, val)
// is equivalent to:
obj.func(val) |
You were right it was a typo:
|
proposal comment
related discussion: microsoft/TypeScript#3694
The text was updated successfully, but these errors were encountered: