https://pulumi.com logo
Title
b

billions-greece-72352

09/07/2021, 7:10 AM
Hi 👋, I'm using typescript and having trouble understanding how imports are meant to be handled during function serialisation. We are using:
const { isLeft } = await import("fp-ts/lib/Either");
Which is `tsc`'d into:
const { isLeft } = await Promise.resolve().then(() => __importStar(require("fp-ts/lib/Either")));
Where
__importStar
is defined at the top most level of the file. After function serialisation, it appears that the
__importStar
definition is not retained (i.e. it hasn't been captured?) so the lambda fails during invocation. When I switch
importHelpers
on in
tsconfig.json
, it does work. The tsconfig.json from the aws-typescript template doesn't have this set. So... can anyone shed light on the expected way to import those runtime dependencies?
d

dry-florist-5950

09/07/2021, 11:59 AM
I dont really know your specific problem but the import
const { isLeft } = await import("fp-ts/lib/Either");
in ts would be
import { isLeft } from 'fp-ts/lib/Either'
assuming the library supports ts