DOM library declaration is required in tsconfig.json for a server-side application

This issue has been tracked since 2023-02-22.

Describe the bug

If the DOM library declaration is not included in tsconifg.json, then compilation fails in connect-core with the error:

node_modules/@bufbuild/connect-core/dist/types/call-options.d.ts (13:15)
13     headers?: HeadersInit;

I would assume this type is only used for browser-side code so it would be great if it's possible to avoid adding DOM as a library for a server-side application.

To Reproduce

  • Set up a TypeScript project which uses connect-node with lib option set to e.g. ["ESNext"] in tsconfig.json.
  • Try to compile it.


  • @bufbuild/connect-web version: 0.7.0
  • @bufbuild/connect-node version: 0.7.0
  • Frontend framework and version: N/A
  • Node.js version: 18.14.0
  • Browser and version: N/A
fubhy wrote this answer on 2023-02-28

This is not just used in browser contexts. Fetch is also available in Node starting in Node v18+. Going forward, the right approach would be to correctly use the right types for the environment that you are targeting with your tsconfig.json. E.g. using @types/node ( in the types field in tsconfig.json. Sadly, fetch is not included in there yet, hence DOM is your second best option (or using @types/web as a workaround).

See also: DefinitelyTyped/DefinitelyTyped#60924

More Details About Repo
Owner Name bufbuild
Repo Name connect-es
Full Name bufbuild/connect-es
Language TypeScript
Created Date 2022-02-16
Updated Date 2023-03-24
Star Count 852
Watcher Count 20
Fork Count 33
Issue Count 17


Issue Title Created Date Updated Date