CARVIEW |
Select Language
HTTP/2 200
date: Sat, 19 Jul 2025 04:41:47 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/microsoft/TypeScript.git
etag: W/"5250f10596cc079472b309e8dd0d561c"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=rvUx8zAx5fwvgg1laKvLiuj0s0TaUUMMzdgRGttJdFPNvs8Fy5GrWim3cTuqNRbnBfuTAftEYkT7JJlQcu6LVJrrs3%2BxDqRsD1GMVDZlqF1WTQkSYowjXeLP1r6galPAVRl5jaEDbI6XygVefWJNRzCro%2Fx3jkgw15%2FbPPEnymj4d0b71P6ZZRP0wLENHcIqDh5xyqCJLBTcQFYGoWqtRt9HeCxNG09xYiZ5vD3yKtmEYc%2BH6sY7rxaxzdahfKUYVgXQpyylpekatU9GYKKd5g%3D%3D--GIaS92Ek3kSAhT9M--RGf0R5ehe6kgKUr3qe1ocg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1637829568.1752900104; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 04:41:44 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 19 Jul 2026 04:41:44 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: CC52:10A6BA:B9A22:FEBED:687B2208
Add globalThis (#29332) · microsoft/TypeScript@be2db9d · GitHub
Dismiss banner
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json
Copy file name to clipboardExpand all lines: src/services/completions.ts
Copy file name to clipboardExpand all lines: src/services/symbolDisplay.ts
Copy file name to clipboardExpand all lines: src/testRunner/unittests/tsserver/projects.ts
Copy file name to clipboardExpand all lines: tests/baselines/reference/assignmentLHSIsValue.symbols
Copy file name to clipboardExpand all lines: tests/baselines/reference/assignmentLHSIsValue.types
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit be2db9d
authored
Add globalThis (#29332)
* Restore original code from bind-toplevel-this
With one or two additional comments
* Working in JS, but the symbol is not right.
Still need to
1. Make it work in Typescript.
2. Add test (and make them work) for the other uses of GlobalThis:
window, globalThis, etc.
* Check in TS also; update some tests
Lots of tests still fail, but all but 1 change so far has been correct.
* Update baselines
A couple of tests still fail and need to be fixed.
* Handle type references to globalThis
The type reference must be `typeof globalThis`. Just `globalThis` will
be treated as a value reference in type position -- an error.
* Restore former behaviour of implicitThis errors
I left the noImplicitThis rule for captured use of global this in an
arrow function, even though technically it isn't `any` any more --
it's typeof globalThis. However, you should still use some other method
to access globals inside an arrow, because captured-global-this is super
confusing there.
* Test values with type globalThis
I ran into a problem with intersecting `Window & typeof globalThis`:
1. This adds a new index signature to Window, which is probably not
desired. In fact, with noImplicitAny, it's not desired on globalThis
either I think.
2. Adding this type requires editing TSJS-lib-generator, not this repo.
So I added the test cases and will probably update them later, when
those two problems are fixed.
* Add esnext declaration for globalThis
* Switch to symbol-based approach
I decided I didn't like the import-type-based approach.
Update baselines to reflect the difference.
* Do not suggest globals for completions at toplevel
* Add tests of element and property access
* Look up globalThis using normal resolution
globalThis is no longer constructed lazily. Its synthetic Identifier
node is also now more realistic.
* Update fourslash tests
* Add missed fourslash test update
* Remove esnext.globalthis.d.ts too
* Add chained globalThis self-lookup test
* Attempt at making globalThis readonly
In progress, had to interrupt for other work.
* Add/update tests
* Addres PR comments:
1. Add parameter to tryGetThisTypeAt to exclude globalThis.
2. Use combined Module flag instead combining them in-place.
3. SymbolDisplay doesn't print 'module globalThis' for this expressions
anymore.1 parent 13c08ab commit be2db9dCopy full SHA for be2db9d
File tree
Expand file treeCollapse file tree
167 files changed
+1372
-400
lines changedFilter options
- src
- compiler
- harness
- services
- testRunner/unittests/tsserver
- tests
- baselines/reference
- cases
- conformance
- es2019
- expressions/thisKeyword
- salsa
- fourslash
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Expand file treeCollapse file tree
167 files changed
+1372
-400
lines changed+7-2Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2499 | 2499 |
| |
2500 | 2500 |
| |
2501 | 2501 |
| |
2502 |
| - | |
2503 |
| - | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
2504 | 2509 |
| |
2505 | 2510 |
| |
2506 | 2511 |
| |
|
+42-17Lines changed: 42 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
88 | 88 |
| |
89 | 89 |
| |
90 | 90 |
| |
| 91 | + | |
91 | 92 |
| |
92 | 93 |
| |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
93 | 101 |
| |
94 | 102 |
| |
95 | 103 |
| |
| |||
310 | 318 |
| |
311 | 319 |
| |
312 | 320 |
| |
313 |
| - | |
| 321 | + | |
314 | 322 |
| |
315 |
| - | |
| 323 | + | |
316 | 324 |
| |
317 | 325 |
| |
318 | 326 |
| |
| |||
459 | 467 |
| |
460 | 468 |
| |
461 | 469 |
| |
462 |
| - | |
463 | 470 |
| |
464 | 471 |
| |
465 | 472 |
| |
| |||
9703 | 9710 |
| |
9704 | 9711 |
| |
9705 | 9712 |
| |
9706 |
| - | |
| 9713 | + | |
9707 | 9714 |
| |
9708 | 9715 |
| |
9709 | 9716 |
| |
| |||
16990 | 16997 |
| |
16991 | 16998 |
| |
16992 | 16999 |
| |
16993 |
| - | |
16994 |
| - | |
16995 |
| - | |
16996 |
| - | |
16997 |
| - | |
16998 |
| - | |
16999 |
| - | |
17000 |
| - | |
17001 |
| - | |
17002 |
| - | |
17003 |
| - | |
17004 |
| - | |
| 17000 | + | |
| 17001 | + | |
| 17002 | + | |
| 17003 | + | |
| 17004 | + | |
| 17005 | + | |
| 17006 | + | |
| 17007 | + | |
| 17008 | + | |
| 17009 | + | |
| 17010 | + | |
| 17011 | + | |
| 17012 | + | |
| 17013 | + | |
17005 | 17014 |
| |
17006 | 17015 |
| |
17007 | 17016 |
| |
17008 | 17017 |
| |
17009 | 17018 |
| |
17010 | 17019 |
| |
17011 |
| - | |
| 17020 | + | |
17012 | 17021 |
| |
17013 | 17022 |
| |
17014 | 17023 |
| |
| |||
17055 | 17064 |
| |
17056 | 17065 |
| |
17057 | 17066 |
| |
| 17067 | + | |
| 17068 | + | |
| 17069 | + | |
| 17070 | + | |
| 17071 | + | |
| 17072 | + | |
| 17073 | + | |
| 17074 | + | |
| 17075 | + | |
| 17076 | + | |
17058 | 17077 |
| |
17059 | 17078 |
| |
17060 | 17079 |
| |
| |||
19352 | 19371 |
| |
19353 | 19372 |
| |
19354 | 19373 |
| |
| 19374 | + | |
| 19375 | + | |
| 19376 | + | |
| 19377 | + | |
| 19378 | + | |
| 19379 | + | |
19355 | 19380 |
| |
19356 | 19381 |
| |
19357 | 19382 |
| |
|
src/compiler/diagnosticMessages.json
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4149 | 4149 |
| |
4150 | 4150 |
| |
4151 | 4151 |
| |
4152 |
| - | |
| 4152 | + | |
4153 | 4153 |
| |
4154 | 4154 |
| |
4155 | 4155 |
| |
|
+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3223 | 3223 |
| |
3224 | 3224 |
| |
3225 | 3225 |
| |
3226 |
| - | |
| 3226 | + | |
3227 | 3227 |
| |
3228 | 3228 |
| |
3229 | 3229 |
| |
|
+13-5Lines changed: 13 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
774 | 774 |
| |
775 | 775 |
| |
776 | 776 |
| |
777 |
| - | |
| 777 | + | |
778 | 778 |
| |
779 | 779 |
| |
780 | 780 |
| |
| |||
841 | 841 |
| |
842 | 842 |
| |
843 | 843 |
| |
844 |
| - | |
| 844 | + | |
845 | 845 |
| |
846 |
| - | |
| 846 | + | |
847 | 847 |
| |
848 | 848 |
| |
849 | 849 |
| |
850 | 850 |
| |
851 |
| - | |
| 851 | + | |
852 | 852 |
| |
853 | 853 |
| |
854 | 854 |
| |
| |||
4545 | 4545 |
| |
4546 | 4546 |
| |
4547 | 4547 |
| |
| 4548 | + | |
4548 | 4549 |
| |
4549 | 4550 |
| |
4550 | 4551 |
| |
| |||
4786 | 4787 |
| |
4787 | 4788 |
| |
4788 | 4789 |
| |
| 4790 | + | |
4789 | 4791 |
| |
4790 | 4792 |
| |
4791 | 4793 |
| |
| |||
4921 | 4923 |
| |
4922 | 4924 |
| |
4923 | 4925 |
| |
| 4926 | + | |
4924 | 4927 |
| |
4925 | 4928 |
| |
4926 | 4929 |
| |
4927 | 4930 |
| |
4928 | 4931 |
| |
4929 | 4932 |
| |
4930 |
| - | |
| 4933 | + | |
| 4934 | + | |
| 4935 | + | |
| 4936 | + | |
| 4937 | + | |
| 4938 | + | |
4931 | 4939 |
| |
4932 | 4940 |
| |
4933 | 4941 |
| |
|
src/services/completions.ts
Copy file name to clipboardExpand all lines: src/services/completions.ts+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1030 | 1030 |
| |
1031 | 1031 |
| |
1032 | 1032 |
| |
1033 |
| - | |
| 1033 | + | |
1034 | 1034 |
| |
1035 | 1035 |
| |
1036 | 1036 |
| |
|
src/services/symbolDisplay.ts
Copy file name to clipboardExpand all lines: src/services/symbolDisplay.ts+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
310 | 310 |
| |
311 | 311 |
| |
312 | 312 |
| |
313 |
| - | |
| 313 | + | |
314 | 314 |
| |
315 | 315 |
| |
316 | 316 |
| |
|
src/testRunner/unittests/tsserver/projects.ts
Copy file name to clipboardExpand all lines: src/testRunner/unittests/tsserver/projects.ts+2-1Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
708 | 708 |
| |
709 | 709 |
| |
710 | 710 |
| |
711 |
| - | |
| 711 | + | |
| 712 | + | |
712 | 713 |
| |
713 | 714 |
| |
714 | 715 |
| |
|
tests/baselines/reference/assignmentLHSIsValue.symbols
Copy file name to clipboardExpand all lines: tests/baselines/reference/assignmentLHSIsValue.symbols+2Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| 30 | + | |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
| |||
116 | 117 |
| |
117 | 118 |
| |
118 | 119 |
| |
| 120 | + | |
119 | 121 |
| |
120 | 122 |
| |
121 | 123 |
| |
|
tests/baselines/reference/assignmentLHSIsValue.types
Copy file name to clipboardExpand all lines: tests/baselines/reference/assignmentLHSIsValue.types+3-3Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
33 | 33 |
| |
34 | 34 |
| |
35 | 35 |
| |
36 |
| - | |
| 36 | + | |
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
| |||
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
162 |
| - | |
163 |
| - | |
| 162 | + | |
| 163 | + | |
164 | 164 |
| |
165 | 165 |
| |
166 | 166 |
| |
|
You can’t perform that action at this time.
0 commit comments