-
Notifications
You must be signed in to change notification settings - Fork 377
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
Tern does not infer types through promises. #486
Comments
Promise is for ECMAScript6. Today tern provides only ecma5.json I have created a PR for ecma6.json #475 But it's very basic. I think Promise should be improved https://github.com/marijnh/tern/pull/475/files#diff-86d0e1883fb47a3188ad9f50734bc5deR465
here it's a JSON Type Definition. I think Promise should be improved with custom inference function (infer.registerFunction).
No but I have created this issues #424 We would like to provide a plugins.json which list the whole tern plugins. I try to integrate tern plugins see https://github.com/angelozerr/tern.java/wiki/Getting-Started#tern-modules To search tern plugins today, you can use those 2 urls : |
Patch 57cf35f adds some magic to the definition of Promises in ecma6.json to make Tern mostly able to see through them, as far as result values are concerned. Let me know whether that works for you (you'll have to include the ecma6 defs to get it). |
Yes, this is exactly the sort of thing I'm looking for 👍 If I get some time, I will attempt a Q plugin based around this. |
I like to add fetch def file.
(fulfill string is just for test) |
Combine the computed type parser and the static type parser so that these actually parse the same language. Also removes the need for guessing that kind of return type we are getting ahead of time. Issue #486
Thanks @marijnh It looks work great but still have some problem.
The first strange behavior I found is that |
Finally I got this solved. |
Using either Promise or Q, tern fails to infer the type of the success handler arguments. I wouldn't say this is a limitation of the tern type inferencer, but it seems like a good candidate for a plugin. Before I look too far into implementing one I was wondering:
a) does such a plugin exist?
b) is this possible with a plugin?
c) how much pain would be involved implementing such a plugin?
And perhaps, more abstractly:
d) is there a central location where developers contribute their tern plugins?
The text was updated successfully, but these errors were encountered: