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

Support globalThis proposal #7704

Closed
wants to merge 1 commit into from
Closed

Conversation

goodmind
Copy link
Contributor

@goodmind goodmind commented May 7, 2019

@volos-st
Copy link

Hello
Any news about globalThis support in Flow?

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 0fe573e.

facebook-github-bot pushed a commit that referenced this pull request Jul 2, 2024
Summary:
In this diff, we add support for [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis). According to the spec, it refers to the global scope, which means that `globalThis.foo` means access of the `foo` global.

In Flow, we can model it as a globally available namespace that contains all the other globals, plus the self referential `globalThis`. We only need to do it in type sig, since global libdef types are generated with type sig. In the validation of libdefs in checking, it will read the globalThis in the global libdef.

Since there is no obvious location for this, I give it `Loc.none`. The tests added ensure that no IDE services will break.

Close #7536
Close #7704

Changelog: [feature] Flow now supports [`globalThis`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis).

Reviewed By: panagosg7

Differential Revision: D59083293

fbshipit-source-id: 57ed57d5ee5f369a3d707ba16e593d12d3720097
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants