Repository navigation
Fix detecting an existing Map/Set - #47409
Merged
Eli Barzilay (elibarzilay) merged 1 commit intoJan 24, 2022
Merged
Conversation
Eli Barzilay (elibarzilay)
requested review from
Daniel Rosenwasser (DanielRosenwasser) and
Ron Buckton (rbuckton)
January 12, 2022 20:46
Contributor
|
The point of the |
Contributor
Author
|
The problem is not in the CJS output. If I set |
Eli Barzilay (elibarzilay)
force-pushed
the
fix-map-set-shims
branch
from
January 14, 2022 11:57
ccca96d to
7a9577d
Compare
Contributor
Author
|
Ron Buckton (@rbuckton), does that make sense? |
Ryan Cavanaugh (RyanCavanaugh)
approved these changes
Jan 19, 2022
Ron Buckton (rbuckton)
suggested changes
Jan 20, 2022
Eli Barzilay (elibarzilay)
force-pushed
the
fix-map-set-shims
branch
2 times, most recently
from
January 24, 2022 19:36
c1beaa1 to
bb2334f
Compare
Ron Buckton (rbuckton)
suggested changes
Jan 24, 2022
Ron Buckton (rbuckton)
left a comment
Contributor
There was a problem hiding this comment.
There's a few more small issues I noticed, after which this should be ready to merge.
Comment on lines
+119
to
+122
| const globals = typeof globalThis !== "undefined" ? globalThis | ||
| : typeof global !== "undefined" ? global | ||
| : typeof self !== "undefined" ? self | ||
| : undefined; |
Contributor
There was a problem hiding this comment.
Minor formatting nit:
Suggested change
| const globals = typeof globalThis !== "undefined" ? globalThis | |
| : typeof global !== "undefined" ? global | |
| : typeof self !== "undefined" ? self | |
| : undefined; | |
| const globals = typeof globalThis !== "undefined" ? globalThis : | |
| typeof global !== "undefined" ? global : | |
| typeof self !== "undefined" ? self : | |
| undefined; |
| */ | ||
| export function tryGetNativeMap(): MapConstructor | undefined { | ||
| // Internet Explorer's Map doesn't support iteration, so don't use it. | ||
| const gMap = globals.Map; |
Contributor
There was a problem hiding this comment.
globals is possibly undefined.
Suggested change
| const gMap = globals.Map; | |
| const gMap = globals?.Map; |
| */ | ||
| export function tryGetNativeSet(): SetConstructor | undefined { | ||
| // Internet Explorer's Set doesn't support iteration, so don't use it. | ||
| const gSet = globals.Set; |
Contributor
There was a problem hiding this comment.
globals is possibly undefined.
Suggested change
| const gSet = globals.Set; | |
| const gSet = globals?.Set; |
This didn't affect compilation to CJS since that sets `exports.Map` instead of creating a global.
Eli Barzilay (elibarzilay)
force-pushed
the
fix-map-set-shims
branch
from
January 24, 2022 19:52
bb2334f to
e0735dd
Compare
Ron Buckton (rbuckton)
approved these changes
Jan 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This didn't affect compilation to CJS since that sets
exports.Mapinstead of creating a global.