Currently, we globally enable both DOM and Node.js types. While this mostly works, it can cause conflicts - particularly with `fetch`. For example, TypeScript may incorrectly allow browser-only properties (like `cache`) and reject valid Node.js ones like `dispatcher`. This PR disables DOM types for server-only packages like payload, ensuring Node-specific typings are applied. This caught a few instances of incorrect fetch usage that were previously masked by overlapping DOM types. This is not a perfect solution - packages that contain both server and client code (like richtext-lexical or next) will still suffer from this issue. However, it's an improvement in cases where we can cleanly separate server and client types, like for the `payload` package which is server-only. ## Use-case This change enables https://github.com/payloadcms/payload/pull/12622 to explore using node-native fetch + `dispatcher`, instead of `node-fetch` + `agent`. Currently, it will incorrectly report that `dispatcher` is not a valid property for node-native fetch
16 lines
707 B
JSON
16 lines
707 B
JSON
{
|
|
"extends": "../../tsconfig.json",
|
|
"compilerOptions": {
|
|
"composite": true, // Make sure typescript knows that this module depends on their references
|
|
"noEmit": false /* Do not emit outputs. */,
|
|
"emitDeclarationOnly": true,
|
|
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
// Do not include DOM and DOM.Iterable as this is a server-only package.
|
|
"lib": ["ES2022"],
|
|
"rootDir": "./src" /* Specify the root folder within your source files. */,
|
|
},
|
|
"exclude": ["dist", "node_modules"],
|
|
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
|
|
"references": [{ "path": "../payload" }, { "path": "../plugin-cloud-storage" }],
|
|
}
|