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

Update Promise type annotations #2732

Merged
merged 1 commit into from
Jul 8, 2015
Merged

Update Promise type annotations #2732

merged 1 commit into from
Jul 8, 2015

Conversation

icholy
Copy link
Contributor

@icholy icholy commented May 19, 2015

Here's a start for #2730

@icholy icholy force-pushed the master branch 2 times, most recently from bd015ae to eebdae9 Compare May 19, 2015 20:45
@icholy icholy changed the title WIP: Update Promise type annotations Update Promise type annotations May 19, 2015
@icholy icholy changed the title Update Promise type annotations WIP: Update Promise type annotations May 19, 2015
@mramato
Copy link
Contributor

mramato commented May 19, 2015

Thanks. I'll take a closer look at this soon. It looks like jsDoc added official support for Promise annotation in 3.3.0 (we are on beta8 but can probably upgrade easily), so I don't see why we shouldn't take advantage of them.

One thing I did notice is that many of your annotations appear to be incorrect (at first glance). For example, loadImage always resolves to an Image instance, so I imagine you would specify that instead of Any.

@icholy
Copy link
Contributor Author

icholy commented May 19, 2015

@mramato its still a WIP, ill ping you when it's ready for review. I wasn't aware of the promise support in jsdoc, I'll check it out.

@@ -135,7 +135,7 @@ define([
* Gets a promise that, when resolved, indicates that the EOP data has been loaded and is
* ready to use.
*
* @returns {Promise} The promise.
* @returns {Promise.<Object>} The promise.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be EarthOrientationParameters ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, this promise resolves to no value, i.e. undefined. We use this pattern in a few places to indicate that some process has finished, but there is no obvious result value of the process.

This particular class is marked "private", though, and is considered undocumented, so I don't think we need to worry about it for now.

In general, perhaps we should perhaps always try to return some value from all promises, even when not really necessary. Perhaps as you suggest this loading promise could resolve to the EarthOrientationParameters object, even though the caller must have already had a reference to that object in order to access the promise in the first place.

@icholy
Copy link
Contributor Author

icholy commented May 20, 2015

@mramato I think it's almost there. Take a look when you have a minute.

I can't find the jsdoc promise support you mentioned. I read through this issue, but there doesn't seem to be anything implemented.

@icholy icholy changed the title WIP: Update Promise type annotations Update Promise type annotations May 20, 2015
@icholy
Copy link
Contributor Author

icholy commented May 20, 2015

Rebased & Squashed

@icholy
Copy link
Contributor Author

icholy commented May 25, 2015

Are there any issues with this this that I still need to address? Or is it just going to take some time to get to/review?

@mramato
Copy link
Contributor

mramato commented May 26, 2015

We just need to take the time for a closer look and review.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jul 5, 2015

What's the plan with this PR?

@icholy
Copy link
Contributor Author

icholy commented Jul 6, 2015

I need these changes to move forward with making TypeScript definition files.

@mramato
Copy link
Contributor

mramato commented Jul 6, 2015

The main problem is determining the impact on our generated documentation. Last I checked, while this was a proposed syntax for jsDoc, it wasn't supported yet. I need to check out the latest version and see if that's changed. Even if they don't support it, we may be able to take this change (as long as the doc still compiled and doesn't drop information).

@icholy
Copy link
Contributor Author

icholy commented Jul 6, 2015

Here's what it looks like
doc

Here's what it looked like before:
doc

edit: AFAIK, no promise support has been added to jsdoc yet.

@mramato
Copy link
Contributor

mramato commented Jul 7, 2015

Thanks @icholy I'll take a final look at this tomorrow and assuming no issues, we can merge it in. Thanks again.

@mramato
Copy link
Contributor

mramato commented Jul 8, 2015

It may have to change in the future when JSDoc gets official Promise support, but it looks like they may choose this syntax anyway. I'll make a tweak in master to change Promise.<Any> to Promise.<Object> for consistency, but that's about it.

mramato added a commit that referenced this pull request Jul 8, 2015
Update Promise type annotations
@mramato mramato merged commit 17dbf05 into CesiumGS:master Jul 8, 2015
@pjcozzi
Copy link
Contributor

pjcozzi commented Jul 8, 2015

@icholy thanks again for this contribution. We appreciate all your pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants