UKHSA-Internal / coronavirus-dashboard-api-javascript-sdk

Coronavirus (COVID-19) in the UK - API Service SDK for JavaScript
MIT License
16 stars 7 forks source link

Does not work with node app #1

Open spock64 opened 4 years ago

spock64 commented 4 years ago

Hi,

Your example does not work in a node.js app. The following error is generated:

const api = new Cov19API({ ^ TypeError: Cov19API is not a constructor

I think it may be to do with the way that you transpire your typescript?

What does work is adding ".default" to the require():

const Cov19API = require('@publichealthengland/uk-covid19').default;

xenatisch commented 4 years ago

Hi @spock64, thanks for the heads up. That's true. I'll correct it later.