Skip to content
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

unable to compile "Cannot find name 'Element'" #5673

Closed
3 tasks done
FrederikPriede opened this issue Sep 1, 2022 · 4 comments · Fixed by #5675
Closed
3 tasks done

unable to compile "Cannot find name 'Element'" #5673

FrederikPriede opened this issue Sep 1, 2022 · 4 comments · Fixed by #5675

Comments

@FrederikPriede
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

7.12.0

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

  • create empty folder
  • switch to newly created folder
  • npm init (use defaults)
  • npm i @sentry/node @types/node typescript
  • npx tsc --init (create vanilla tsconfig)
  • change lib property within tsconfig.json to ES2020
  • change skipLibCheck to false
  • create simple source file test.ts
import { captureException } from "@sentry/node";
captureException(new Error());
  • run npx tsc

Expected Result

test.ts should compile to test.js

Actual Result

Compiling fails with this error:

node_modules/@sentry/utils/types/browser.d.ts:22:58 - error TS2304: Cannot find name 'Element'.
22 export declare function getDomElement(selector: string): Element | null;
                                                            ~~~~~~~
Found 1 error in node_modules/@sentry/utils/types/browser.d.ts:22
@FrederikPriede
Copy link
Author

I found some workarounds for this:

  • revert the version of @sentry/node back to 7.11.1
  • add DOM to the lib option within your tsconfig (or use the --libparam of tsc)
  • set skipLibCheck option to false or remove it completly

Sadly, I cant use any of those workarounds. I think this issue was introduced with #5594. Interestingly a very similar issue happened earlier this year, see #4449. @AbhiPrasad fixed this issue with #4451, removing all references to DOM.

@Lms24
Copy link
Member

Lms24 commented Sep 1, 2022

Hi @FrederikPriede thanks for reporting. I agree, this is caused by #5594. We'll fix this and include it in the next release.

@AbhiPrasad
Copy link
Member

Let's actually get this out ASAP to unblock TS users - I'll open a patch.

@Lms24
Copy link
Member

Lms24 commented Sep 2, 2022

Hi @FrederikPriede we just released a patch (7.12.1) with the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants