Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

fix(promise): Update ZoneAwarePromise to better match Promise #940

Closed
wants to merge 1 commit into from

Conversation

sandersn
Copy link

This allows zone.js to compile on Typescript 2.4 and above.

ZoneAwarePromise doesn't correctly extend Promise: then and catch both need to have different types for the onRejected return type (same is true of scheduleResolveOrReject). And the value parameter of onFulfilled should not be the same as the promised return type.

Typescript 2.6 also catches a location where type inference fails and requires a type argument.

I fixed the ZoneAwarePromise definition basically by copying the definition of then from Promise.

Fixes #939.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@sandersn
Copy link
Author

I signed the CLA.

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@justindujardin
Copy link
Contributor

NativeScript maintains a fork of zone.js because they have different platform patch requirements.

In order to remove the fork, they need to add a zone-nativescript.ts file that imports the correct bits from node_modules/zone.js/lib/....

The build breaks when including lib/common/promise.ts because of this type error.

Please accept it 🙏

Copy link
Contributor

@justindujardin justindujardin left a comment

Choose a reason for hiding this comment

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

This breaks the CI build because the format is incorrect. Helpfully it tells you how to fix it:

[23:17:03] WARNING: Files are not properly formatted. Please run
[23:17:03]   node_modules/clang-format/index.js -i -style="file" /home/travis/build/angular/zone.js/lib/common/promise.ts

https://travis-ci.org/angular/zone.js/builds/292884747#L2104

@sandersn
Copy link
Author

Now the CI build fails like this:

[1] 27 10 2017 16:54:30.995:WARN [watcher]: Pattern "/home/travis/build/angular/zone.js/build/**/*.js.map" does not match any file.
[1] 27 10 2017 16:54:32.247:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
[1] 27 10 2017 16:54:32.253:INFO [launcher]: Starting browser PhantomJS
[1] 27 10 2017 16:54:32.467:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket -s_PUlt8A7DYvQJrAAAA with id 59376715
[1] 27 10 2017 16:54:33.437:WARN [web-server]: 404: /base/node_modules/rxjs/operators.js
[1] PhantomJS 2.1.1 (Linux 0.0.0) ERROR: '(SystemJS) XHR error (404 Not Found) loading http://localhost:9876/base/node_modules/rxjs/operators.js
[1] 	Error loading http://localhost:9876/base/node_modules/rxjs/operators.js as "./operators" from http://localhost:9876/base/node_modules/rxjs/Rx.js'
[1] 
[1] 27 10 2017 16:54:43.558:WARN [PhantomJS 2.1.1 (Linux 0.0.0)]: Disconnected (1 times), because no message in 10000 ms.

I have no idea what happened here.

Copy link
Contributor

@justindujardin justindujardin left a comment

Choose a reason for hiding this comment

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

The rxjs failure is a known issue unrelated to your PR.

LGTM

@JiaLiPassion
Copy link
Collaborator

the CI will be ok after #935 is merged, currently rxjs 5.5.0 has conflict with systemjs.

@sandersn
Copy link
Author

Do I need to bump travis after that happens?

@JiaLiPassion
Copy link
Collaborator

@sandersn , I will do that for you, I can restart travis build for all failure pull request.

…stable macroTask (angular#938)

* fix(fakeAsyncTest): fix angular#937, let user be able to customize testable macroTask

* add global flag to define fakeAsyncTest macroTaskOptions

* support set callback arguments
@mhevery mhevery force-pushed the update-promise-definition branch from 34ac330 to 87b0afb Compare December 27, 2017 20:06
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

1 similar comment
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@mhevery
Copy link
Contributor

mhevery commented Dec 27, 2017

I rebased and push squash your SHAs. Waiting for travis.

@mhevery
Copy link
Contributor

mhevery commented Dec 27, 2017

Just realized this was addressed in 1acab39. Closing as duplicate

@mhevery mhevery closed this Dec 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails to compile on Typescript 2.5 and 2.6
5 participants