globalThis
sometimes being stripped from type emition can leads to errors in emited definition
#48783
Labels
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
🔎 Search Terms
globalThis, removed, remove, stripped, 2502, own type annotation, referenced, definition, .d.ts
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code, mainly using the
D.TS
tab💻 Code
🙁 Actual behavior
This code will generate the following
.d.ts
file, which contains the'fetch' is referenced directly or indirectly in its own type annotation. (2502)
error🙂 Expected behavior
Generated d.ts file should keep the reference to
globalThis
as it does when declaring a function, type or class:
🤔 Workaround
Typing the const instead of the anonymous function works as expected.
The text was updated successfully, but these errors were encountered: