[superagent] silently includes DOM typings in Node.js projects #55382
-
This is a reopening of #41425 after being closed in the transition to GH Discussions. I think this is still a valid issue, since importing DOM typings into a Node.js project is highly surprising (especially just by installing a dev testing library like |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 5 replies
-
Thanks for the discussion about "superagent", some useful links for everyone: Pinging the DT module owners: @NicoZelaya, @mxl, @paplorinc, @shreyjain1994, @zopf, @BeeeQueue, @lukaselmer, @theQuazz, @carnesen, @ghostganz, @LuckyWindsck. |
Beta Was this translation helpful? Give feedback.
-
I agree that this is a problem, I've been stuck on a problem for a good few hours before I found out superagent was declaring global DOM types! Are there any proposed solutions? |
Beta Was this translation helpful? Give feedback.
-
I've been experimenting with rewriting isomorphic library typings to remove triple-slash references and instead explicitly import individual types from the relevant modules using |
Beta Was this translation helpful? Give feedback.
-
I just found that
They solved it by copying the required DOM lib types into their package :-/ Regarding this discussion, the same solution will need to be applied to isomorphic-fetch, should we add that to the issue title? |
Beta Was this translation helpful? Give feedback.
-
I've raised a PR to try and promote discussion on the repo itself: #57641 |
Beta Was this translation helpful? Give feedback.
-
Anybody watching this discussion will probably be interested in #59905, I'm struggling a bit but trying to rectify this. It's getting hairy because I think the Node "DOM-like" APIs are not 100% compatible with the actual DOM. I'm not quite sure how to have e.g. a global |
Beta Was this translation helpful? Give feedback.
I've raised a PR to try and promote discussion on the repo itself: #57641