KharalDipendra/hastexp

undefined && TypeError: HastExp is not a constructor

Closed this issue · 3 comments

I'm doing exactly how it is saying me to do but it isn't working.

code snippet:

const HastExp = require('hastexp')

const haste = new HastExp()

haste.makePost("This is a test")
    .then(link => console.log(link))
    .catch(error => console.log(error))

Before trying to go a little deeper into the code , my snippet was returning undefined every time.
After that, I tried looking for the source code in the VS Code and got an error that said I didn't had installed node-fetch, so I did as it asked and did npm i --save-dev @types/node-fetch.

Then it was throwing an error saying that HastExp was not a constructor.

const haste = new HastExp()
              ^

TypeError: HastExp is not a constructor
    at Object.<anonymous> (C:\Users\pedro\Documents\BOTS\backup-bot\testes.js:31:15)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

I've already installed npm install -g typescript too

try importing it like this

const {HastExp} = require('hastexp')

I'm closing this thread now open a new issue if you have any more bug reports.