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

Dom types not usable in nodejs (Cannot find name 'HTMLElement') #389

Open
pxDot opened this issue Nov 12, 2021 · 3 comments
Open

Dom types not usable in nodejs (Cannot find name 'HTMLElement') #389

pxDot opened this issue Nov 12, 2021 · 3 comments

Comments

@pxDot
Copy link

pxDot commented Nov 12, 2021

In backend nodejs projects the DOM types (HTMLElement) are only accessible if included explicitly by e.g. "lib": ["ES2020", "dom"] in tsconfig. Building without the included dom types gives the following error:

node_modules/juice/juice.d.ts:27:36 - error TS2304: Cannot find name 'HTMLElement'.

27   export let heightElements: HTMLElement[];
                                      ~~~~~~~~~~~
node_modules/juice/juice.d.ts:29:39 - error TS2304: Cannot find name 'HTMLElement'.

29   export let nonVisualElements: HTMLElement[];
                                         ~~~~~~~~~~~
node_modules/juice/juice.d.ts:31:35 - error TS2304: Cannot find name 'HTMLElement'.

31   export let tableElements: HTMLElement[];
                                     ~~~~~~~~~~~
node_modules/juice/juice.d.ts:32:35 - error TS2304: Cannot find name 'HTMLElement'.

32   export let widthElements: HTMLElement[];

Including all of the dom types only for the HTMLElement type seems like a bad idea and introducing alot of bloat.

Is there any workaround or possibility for another usable type here?

@qqilihq
Copy link

qqilihq commented Feb 16, 2022

Same here. I didn't want to include dom either, so I worked around this for now:

 declare type HTMLElement = never;

@SMKH-PRO
Copy link

SMKH-PRO commented Oct 26, 2022

Same here. I didn't want to include dom either, so I worked around this for now:

 declare type HTMLElement = never;

I am also facing the same issue.

@qqilihq Where to add this type?

did you patch the package?

@qqilihq
Copy link

qqilihq commented Oct 26, 2022

@SMKH-PRO I added it in a global typing file in my project afair. Definitely no patching needed.

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

No branches or pull requests

3 participants