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

Fix: Cannot find name FormData type error & remove HTMLFormElement type error #354

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Procaseycash
Copy link

@Procaseycash Procaseycash commented Apr 8, 2023

Issue:

  1. Cannot find name FormData type error exception in tsc build
  2. HTMLFormElement as a type for FormData error
    Issue:
node_modules/mailgun.js/interfaces/IFormData.d.ts:6:20 - error TS2304: Cannot find name 'HTMLFormElement'.

6     new (options?: HTMLFormElement | IFormDataOptions): NodeFormData | FormData;
                     ~~~~~~~~~~~~~~~

node_modules/mailgun.js/interfaces/IFormData.d.ts:6:72 - error TS2304: Cannot find name 'FormData'.

6     new (options?: HTMLFormElement | IFormDataOptions): NodeFormData | FormData;
                                                                         ~~~~~~~~

node_modules/mailgun.js/request.d.ts:20:127 - error TS2304: Cannot find name 'FormData'.

20     command(method: string, url: string, data?: Record<string, unknown> | Record<string, unknown>[] | string | NodeFormData | FormData, options?: Record<string, unknown>, addDefaultHeaders?: boolean): Promise<APIResponse>;
                                                                                                                                 ~~~~~~~~


Found 3 errors in 2 files.

Errors  Files
     2  node_modules/mailgun.js/interfaces/IFormData.d.ts:6
     1  node_modules/mailgun.js/request.d.ts:20

Solution:

  1. Remove the usage of FormData which was already called NodeFormData after import.
  2. HTMLFormElement was remove.

Issue:

```

node_modules/mailgun.js/interfaces/IFormData.d.ts:6:20 - error TS2304: Cannot find name 'HTMLFormElement'.

6     new (options?: HTMLFormElement | IFormDataOptions): NodeFormData | FormData;
                     ~~~~~~~~~~~~~~~

node_modules/mailgun.js/interfaces/IFormData.d.ts:6:72 - error TS2304: Cannot find name 'FormData'.

6     new (options?: HTMLFormElement | IFormDataOptions): NodeFormData | FormData;
                                                                         ~~~~~~~~

node_modules/mailgun.js/request.d.ts:20:127 - error TS2304: Cannot find name 'FormData'.

20     command(method: string, url: string, data?: Record<string, unknown> | Record<string, unknown>[] | string | NodeFormData | FormData, options?: Record<string, unknown>, addDefaultHeaders?: boolean): Promise<APIResponse>;
                                                                                                                                 ~~~~~~~~


Found 3 errors in 2 files.

Errors  Files
     2  node_modules/mailgun.js/interfaces/IFormData.d.ts:6
     1  node_modules/mailgun.js/request.d.ts:20


```
FormData as HTMLFormElement causes an error when formData is passed down.
Remove formData as it is not declared causing failure for build in tsc
@Procaseycash Procaseycash changed the title Fix: Cannot find name FormData type error Fix: Cannot find name FormData type error & HTMLFormElement error Apr 8, 2023
@Procaseycash Procaseycash changed the title Fix: Cannot find name FormData type error & HTMLFormElement error Fix: Cannot find name FormData type error & HTMLFormElement type error Apr 8, 2023
@Procaseycash Procaseycash changed the title Fix: Cannot find name FormData type error & HTMLFormElement type error Fix: Cannot find name FormData type error & remove HTMLFormElement type error Apr 8, 2023
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

Successfully merging this pull request may close these issues.

1 participant