Skip to content

Cannot compile TS with @sentry/node without lib: DOM definitions present #4449

Closed
@NoNameProvided

Description

@NoNameProvided

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

6.17.1

Description

The sentry/node package incorrectly assumes there are types for DOM on the server. So when trying to compile a NodeJS app the following two error occurs:

node_modules/@sentry/utils/dist/is.d.ts:65:55 - error TS2304: Cannot find name 'Event'.

65 export declare function isEvent(wat: unknown): wat is Event;
                                                         ~~~~~

node_modules/@sentry/utils/dist/is.d.ts:73:57 - error TS2304: Cannot find name 'Element'.

73 export declare function isElement(wat: unknown): wat is Element;
                                                           ~~~~~~~

Found 2 errors.

Technically this happens because we override the lib in TS config so there are no types for DOM, however, I think this is a correct assumption on the server-side, and adding simply dom to lib in TS config is not a good solution.

There is a ~3 year old related issue here: #2266

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions