fix(zone.js): remove global declaration#37861
fix(zone.js): remove global declaration#37861JiaLiPassion wants to merge 1 commit intoangular:masterfrom
Conversation
|
CARETAKER: Needs cl/321604430 |
|
This is failing with I think adding solves the problem. |
eea4b57 to
3417b9f
Compare
|
@mhevery , got it, thanks, I just updated the |
|
Argh! Seems like that did not help. :-( It seems that we can't remove the global declaration from google3. What is the motivation behind this change? |
|
@mhevery, The motivation is the issue #37531, I will update the |
b104a80 to
b26e108
Compare
|
Hmm, it seems like the build system does not like that. |
|
The Therefore, I think the solution could be, in fact, to exactly mirror the global declaration (Or maybe remove it instead?). I've bypassed this since the bug appeared by applying the next patch after
It doesn't generate any side effects and everything seems alright so far. I guess the global type should be declared as Maybe removing it could solve it too, just by letting the |
packages/zone.js/lib/zone.ts
Outdated
There was a problem hiding this comment.
Oh! I see! I didn't knew about the suggestion feature. Thanks @kenaidri!
packages/zone.js/lib/zone.ts
Outdated
There was a problem hiding this comment.
| declare var global: any; | |
| declare var global: NodeJS.Global & typeof globalThis; |
Make sure that the global type matches the one provided by the current @types/node module to solve type conflicts.
packages/zone.js/package.json
Outdated
There was a problem hiding this comment.
| "@types/node": "^14.0.5", | |
| "@types/node": "^14.0.27", |
Upgrade @types/node to last version.
There was a problem hiding this comment.
Yeah, we have to wait for node in angular repo update to 14.0.27+ and continue on this PR later.
There was a problem hiding this comment.
| (global as any).Promise = WrongPromise; | |
| global.Promise = WrongPromise; |
I'm not actually sure about this one.
Redeclaration with different type is a no go but that doesn't prevent recasting as far as I know.
How do you think it should be done?
- Leave global uncasted as it was before.
- Replace the
anyglobal cast with a(NodeJS.Global & typeof globalThis)one. - Don't change anything at all and leave the cast as
any.
There was a problem hiding this comment.
Upgrade @types/node from v14.0.5 to v14.0.27.
Mirror the global declaration provided by the @types/node module (breaking change).
Edit: I apologize for sending 4 reviews in a row. It's been an error due to my lack of experience with the suggestion feature! I've learnt the lesson and next times I'll start a review instead of adding single comments!
|
@dag03tsc , no problem, thank you for the review, |
b26e108 to
0b1b1ed
Compare
josephperrott
left a comment
There was a problem hiding this comment.
LGTM
Reviewed-for: dev-infra
Close angular#37531 Remove `global` declaration in `zone.ts` to avoid compile error when upgrade to `@types/node` v12.12.68. Since the new type of global become `NodeJS.global & typeof globalThis` and not compatible with `zone.ts` declaration.
0b1b1ed to
9211fbb
Compare
|
Caretaker Note: This will require cl/338344996 to land before it can be merged. |
|
@josephperrott @JiaLiPassion based on the "target: major" label and the current state of release train, this PR will be included into v12 (and will not land in upcoming v11). The target was set a couple months ago, so I believe the intention was to land it in v11, so should we change the label to "target: rc" (to target |
|
@AndrewKushnir , yes, this one is targeting |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Close #37531
Remove
globaldeclaration in zone.ts to avoid compile error whenupgrade to
@types/node.PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: 37531
What is the new behavior?
Does this PR introduce a breaking change?
Other information