westy92/html-pdf-chrome

Typescript doesn't recognize any of this module's methods

capndave opened this issue · 1 comments

I've downloaded and used this module successfully using node, but typescript doesn't seem to recognize any properties of this module.

Example:

const getPdfStreamFromHtml = async function(html: string) {
    try { 
      const options = htmlPdf.CreateOptions = {
        port: 9222,
        host: process.env.CHROME_SERVER
      }
      const pdf = await htmlPdf.create(html, options)
      return pdf.toStream()
    } catch (error) {
      throw `${fileName} [70]: ${error}`
    }
  }

getPdfStreamFromHtml(html)

throws TypeError: Cannot read property 'CreateOptions' of undefined and TypeError: Cannot read property 'create' of undefined

Let me know if I'm missing something - I'm happy to help add some types if needed.

Sorry, dumb mistake. notice the two equals signs in the options declaration above. Closing!