Bug Report
🔎 Search Terms
globalThis, removed, remove, stripped, 2502, own type annotation, referenced, definition, .d.ts
🕗 Version & Regression Information
- This is the behavior in every version I tried, since 3.5.1, and I reviewed the FAQ for entries about globalThis, 2502, own type annotation
⏯ Playground Link
Playground link with relevant code, mainly using the D.TS tab
💻 Code
exportconstfetchSomething=(fetch: typeofglobalThis.fetch): typeofglobalThis.fetch=>fetch
🙁 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
exportdeclareconstfetchSomething: (fetch: typeoffetch)=>typeoffetch;
🙂 Expected behavior
Generated d.ts file should keep the reference to globalThis
exportdeclareconstfetchSomething: (fetch: typeofglobalThis.fetch)=>typeofglobalThis.fetch;
as it does when declaring a function, type or class:
exporttypeFetchSomething={fetch: typeofglobalThis.fetch}exportclassFetchSomethingClass{fetch?: typeofglobalThis.fetch}exporttypeFetchSomethingFunction=(fetch: typeofglobalThis.fetch)=>typeofglobalThis.fetch// .d.tsexportdeclaretypeFetchSomething={fetch: typeofglobalThis.fetch;};exportdeclareclassFetchSomethingClass{fetch?: typeofglobalThis.fetch;}exportdeclaretypeFetchSomethingFunction=(fetch: typeofglobalThis.fetch)=>typeofglobalThis.fetch;🤔 Workaround
Typing the const instead of the anonymous function works as expected.
exportconstfetchSomething: (fetch: typeofglobalThis.fetch)=>typeofglobalThis.fetch=(fetch)=>fetch;
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.TStab💻 Code
🙁 Actual behavior
This code will generate the following
.d.tsfile, 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
globalThisas it does when declaring a function, type or class:
🤔 Workaround
Typing the const instead of the anonymous function works as expected.