Skip to content

Conversation

@catdevnull
Copy link

Use tsimp instead of ts-node and make sure all imports follow actual ESM

Similar to hyphacoop/social.distributed.press#65

Use tsimp instead of ts-node and make sure all imports follow actual ESM
@catdevnull
Copy link
Author

Marked as draft as I can't get that IPFS type error fixed. I believe it's a bug in the upstream libraries.

@RangerMauve
Copy link
Contributor

Maybe you could override the types somehow? Does the code run if you ignore type errors?

@catdevnull
Copy link
Author

Maybe you could override the types somehow? Does the code run if you ignore type errors?

Type errors can't be ignored with tsimp, as it uses the official TypeScript compiler (tsc). That's why I suggested using something like tsx, which uses esbuild, which just transpiles TypeScript into JavaScript without typechecking. Then, typechecking can be done by a CI or a watch script, along with tests/linting.

I'll try to override the types.

@catdevnull
Copy link
Author

I'm trying to work on this but dist.ipfs.tech is down since yesterday, so npm install on go-ipfs doesn't work :|

this causes types error and also is already done by every controller in ipfsd-ctl
sadly it seems the types in this package are bad, and we're using an outdated version. I tried upgrading the packge but it seems that there's a ton of API changes, so I'll leave it like this for now.
@catdevnull
Copy link
Author

I think these changes are OK for now. Either way we should upgrade the ipfsd-ctl package at some point.

@catdevnull catdevnull marked this pull request as ready for review August 2, 2024 18:10
@catdevnull
Copy link
Author

Just noticed that while the TS is fine, the linting on the IPFS file is broken. As I mentioned we should probably migrate off of ipfsd-ctl as its types are broken and the readme says

It is designed mostly for testing interoperability and is not suitable for production use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants