leinelissen / embedded-postgres

🐘 A Node package that allows you to spawn a Postgresql cluster programatically.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with the way that `EmbeddedPostgres` is exported

JamesMcNee opened this issue · comments

Hi!

Having an issue whilst trying to use your lib in a typescript project as getting the below error during build.

Error:

node_modules/embedded-postgres/dist/index.d.ts(100,1): error TS2309: An export assignment cannot be used in a module with other exported elements.

I believe this line just needs to be export default EmbeddedPostgres but I have not been successful in getting the project to build to test this for myself. However locally altering the .d.ts file to this does resolve it.

Let me know if any more info would be helpful!

I think this might have to do with a new Typescript version being a bit more strict with its checks. If I remember correctly, the exports = was a solution to a problem I faced supporting both CommonJS and ESM, so let me check if the current approach is still feasible. Also, what problems did you run into trying to get the project running / building? I get this feedback more often, but I don't fully grasp where things go wrong.

Hey @leinelissen, thanks for the response, I agree that it seems like later versions of typescript seem to be stricter with this.

In terms of getting the project building locally, I have a feeling it was related to the symlinking, but it also seemed that it might have been trying to use an x86 binary (I am on an M1 Macbook) by default. I did not actually spend terribly long time on it though, and cannot quite remember the details now.

If you had the time/inclination to publish some getting started / local development instructions I would be happy to give it another go 👍

Hey @JamesMcNee, it's been a while, but I finally managed to get around to this. I've solved many problems with the dev environment, and the README now includes a small section on how to get it setup. Would love to get your input!

Hey @leinelissen! Oh nice, I will try to find some time at the weekend to have a look and feedback!