forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.64k stars 339 forks source link

[fix] "Cannot find name 'HTMLElement')." Underlying package Juice is abandoned #438

Closed Wandang closed 2 years ago

Wandang commented 2 years ago

Describe the bug

Node.js version: Node 16.13.0

OS version: Mac

Description: Using email-template 9.x in our project does not compile. It results in an error triggered by an underlying package juice, which is no longer maintained (current maintainer posted that he is searching for someone to continue maintaining).

The bug itself was posted there as well:

https://github.com/Automattic/juice/issues/389

Actual behavior

Error output:

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

27   export let heightElements: HTMLElement[];
                                ~~~~~~~~~~~

node_modules/juice/juice.d.ts:29:33 - error TS2304: Cannot find name 'HTMLElement'.

29   export let nonVisualElements: HTMLElement[];
                                   ~~~~~~~~~~~

node_modules/juice/juice.d.ts:31:29 - error TS2304: Cannot find name 'HTMLElement'.

31   export let tableElements: HTMLElement[];
                               ~~~~~~~~~~~

node_modules/juice/juice.d.ts:32:29 - error TS2304: Cannot find name 'HTMLElement'.

32   export let widthElements: HTMLElement[];

Expected behavior

Compiling/starting the project works. Maybe another css-injector should be supplemented?

For now I applied the fix suggested inside the linked issue:

    "lib": ["ES2020","DOM"],

Which solves the issue for now.

Code to reproduce

Checklist

titanism commented 2 years ago

We don't support TypeScript. If you want to submit a PR to fix this, we're open to it. We also suggest you contribute to the juice package to help resolve the issue (we will not be doing this as we do not support TS nor use TS).

boredland commented 1 year ago

If you want to submit a PR to fix this

do you mean a transformation into typescript or a bugfix regarding that issue? I'd be open to give the typescript-transformation a try, if there is a chance we could get that merged. From a first glance, most modules already have typescript support built-in, so this should be only a matter of cleaning up the class a bit.

titanism commented 1 year ago

I'd review a PR or could have someone look at it for us.

titanism commented 1 year ago

Oh sorry, no transformation into TS - a bugfix for the underlying issue is probably the route to go? We will def be in pure vanilla JS for the future and present.

boredland commented 1 year ago

Ok, good to know. Nah, won't do that, sorry.