yumauri / gotenberg-js-client

A simple JS/TS client for interacting with a Gotenberg API
MIT License
111 stars 9 forks source link

cannot find name URL #37

Closed ashiishme closed 2 years ago

ashiishme commented 3 years ago

The _types.ts & gotenberg.ts is missing the URL import which throws error when building the project ( hopefully I think only backend ) that depends on Gotenberg service.

Error: node_modules/gotenberg-js-client/dist-types/_types.d.ts(68,30): error TS2304: Cannot find name 'URL'.
Error: node_modules/gotenberg-js-client/dist-types/gotenberg.d.ts(3,57): error TS2304: Cannot find name 'URL'.

To re-create:

yumauri commented 3 years ago

Hello! URL class is available globally in Node.js since version 10, but still wasn't added to node types ._. As a temporary solution you can add "dom" to your tsconfig.json libs.

ashiishme commented 3 years ago

Thank you for giving more insight of the issue. Is there any other alternatives rather than using "dom"?

yumauri commented 3 years ago

I tried to add

import { URL } from 'url'

to where URL is used.

Can you try version 0.7.1, will it work out for you?

yumauri commented 3 years ago

BTW, for now, this is backend only client, because it heavily relies on Node.js internals

ashiishme commented 2 years ago

@yumauri Thank you for the new release. Yes, it resolved the TS complain about URL.