-
Notifications
You must be signed in to change notification settings - Fork 106
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
Typings in index.d.ts cause dom types to be available globally in any package using cross-fetch #70
Comments
I came here after running into this issue: graffle-js/graffle#206 Referencing the TS dom lib in packages which also target node causes problems... DefinitelyTyped/DefinitelyTyped#12044 (comment) In addition to the disjoint set of globals, there are also conflicting global types, like the return types of timer functions. |
Any movement on this? Ended up moving to TypeScript on a node.js project that uses this library. |
@lquixada would you welcome a PR addressing this? |
@LilRed sure! The ideal PR would be all the type definitions for |
👋 Hi, after running into this issue several times across various projects, I recently wrote a script to automate the extraction of dom lib types for the SimpleWebAuthn project. In my [minuscule] free time, I've been working on making a standalone CLI out of it in case other projects wanted to take a similar approach. I just published an initial version under the package name ts-graft. It is still very basic, but it is functional and I believe can make the task of extracting type definitions from lib files much easier than doing so by hand. I'm not necessarily trying to promote the project - I've barely had any time to work on it as is, but if you want to try it out for this, I think it will make the chore very easy. Of course, if you do have any feedback on what I've got, it's welcome. 🤗 |
hey @jstewmon! this tool looks amazing! will def take a look at it! Thanks! |
Closing this as it was addressed on PR #93 . |
Noting here that the closing PR got reverted, so this issue still stands. If the type namespaces match, can we avoid using In the browser tsconfig, the declarations should merge, right? |
Hello, just came across this issue. It's still present in 3.1.5. May I ask why @jstewmon's PR was reverted? We could use |
The 4.0.0 version still contains the dom import which can cause errors when used casually with node, such reference is too strong for use in types right now. This cange needs to be reviewed again |
I just ran into this issue too, running Until this is fixed, as a workaround you can set the version to
|
Since index.d.ts contains
/// <reference lib="dom" />
, all the lib.dom types are imported globally for anyone who uses cross-fetch: microsoft/TypeScript#33901That means if I'm working in a TypeScript project where I don't want to have lib.dom available (which is surely true of anyone using cross-fetch) I have to somehow override the cross-fetch typings.
I suggest depending on
@types/node-fetch
instead and usingto re-export the declarations from it.
The text was updated successfully, but these errors were encountered: