cross-fetch
                                
                                 cross-fetch copied to clipboard
                                
                                    cross-fetch copied to clipboard
                            
                            
                            
                        [Typescript] DOM libs are undefined (v3.1.2)
When installing cross-fetch v3.1.3, it somehow overrides the typescript settings. Despite having dom in lib in the tsconfig, Typescript starts to complain about e.g. window and URLSearchParams. If I downgrade to v3.1.2, it does not happen. Maybe you have an idea, why cross-fetch somehow overrides "everything" (?)
I'm using it with nextjs (latest version)
We're having the exact same problem. Would be great if this could be solved as soon as possible.
@wiesson can you share your tsconfig?
Sure!
{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "baseUrl": "src",
    "paths": {
      "@/components/*": ["components/*"],
      "@/lib/*": ["lib/*"],
      "@/utils/*": ["utils/*"],
      "@/types/*": ["types/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
  "exclude": ["node_modules"]
}
it is more or less the default tsconfig of Nextjs
Possibly caused by https://github.com/lquixada/cross-fetch/commit/f3b2fc48fb57ffaeabd9f2f9e598b76cb511831b which added no-default-lib triple slash directives. Once I remove that directive from my local typings, everything is back to normal. The directive will instruct TypeScript to not include their lib.d.ts.
I've never seen this directive used in library typings so I can't say what this commit tried to solve. Maybe @lquixada has some insight?
This is breaking the faunadb library as well.
At this point, my whole project is unusable, is there a workaround (like a smart edit of the yarn.lock to force using the previous version?)
https://github.com/fauna/faunadb-js/issues/459
And I can concur about the triple slash directive, it's what causing the issue.
hey all! sorry for the trouble! adding local types to cross-fetch has been trickier than originally thought so I'm reverting those changes so everyone can run it safely. Please let me know if 3.1.4-alpha.0 works for you.
For anyone affected by this, you can add the following to package.json:
  "resolutions": {
    "cross-fetch": "3.1.4-alpha.0"
  }
@lquixada I can confirm that it fixes it for my project!
just released 3.1.4