-
Notifications
You must be signed in to change notification settings - Fork 17
Can't import module from typescript #23
Comments
Hi @kuka-radovan there has been a new release recently and using the sample code below I was able to import the health-connect module using import * as health from '@cloudnative/health-connect' and it seems to be working. My sample express app using health-connect in typescript is below. Let me know if you still encounter problems. import express from 'express';
import * as health from '@cloudnative/health-connect';
const port = 3000;
const app = express();
let healthCheck = new health.HealthChecker();
const livePromise = () => new Promise<void>((resolve, _reject) => {
setTimeout(resolve, 100, 'foo');
});
let liveCheck = new health.LivenessCheck("liveCheck", livePromise);
healthCheck.registerLivenessCheck(liveCheck);
app.use('/live', health.LivenessEndpoint(healthCheck))
app.get('/', (req, res) => {
res.send('Hello!');
});
app.listen(port, () => {
console.log("Listening on 3000");
}); |
Hi @andrewhughes101, thank you for your reply. I have the same result also with the new version. Please, can you provide your |
Hi I'm using the same |
I don't understand, why I am getting |
I wanted to import this module to my typescript code. I tried to do it as follows:
or I even tried
But I cannot reach exported classes (e.g.
HealthChecker
). I am gettingundefined
from callinghealth.HealthChecker
from first option orModule "@cloudnative/health-connect/index" has no default export.
in case of second option.The only solution I found is to import it like this
but I personally don't like it and don't understand, why I have to rename default export that looks like it doesn't even has.
Do you have any solution or recommendation how to use this package in typescript? I am using typescript
v 3.6.3
.The text was updated successfully, but these errors were encountered: