-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipfs-unixfs-importer
: import
type declaration imports UnixFS
from the wrong location
#214
Comments
@achingbrain Let me know if there's anything that i can help provide clarity on. |
We have `typesVersions` to allow deep imports from these modules, but they cause incorrect paths to be detected by tsc (see #214). Since #161 we control exports using the exports map, and we only export the root from each module so `typesVersions` isn't necessary. Since it's causing problems and we don't need it, remove it. We can revisit once we publish ESM-only but right now this fixes up the types tsc generates. Fixes #214
We have `typesVersions` to allow deep requires from these modules, but they cause incorrect paths to be detected by tsc (see #214). Since #161 we control exports using the exports map, and we only export the root from each module so deep requires are disallowed and consequently `typesVersions` isn't necessary. Since it's causing problems and we don't need it, remove it. We can revisit once we publish ESM-only but right now this fixes up the types tsc generates. Fixes #214
🎉 This issue has been resolved in version ipfs-unixfs-v6.0.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [ipfs-unixfs-importer-v9.0.10](ipfs-unixfs-importer-v9.0.9...ipfs-unixfs-importer-v9.0.10) (2022-05-27) ### Bug Fixes * remove typesVersions from package.json ([#219](#219)) ([465670e](465670e)), closes [#214](#214) [#161](#161) [#214](#214) ### Trivial Changes * update dep-check command ([#221](#221)) ([5802bd3](5802bd3))
🎉 This issue has been resolved in version ipfs-unixfs-importer-v9.0.10 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [ipfs-unixfs-exporter-v7.0.11](ipfs-unixfs-exporter-v7.0.10...ipfs-unixfs-exporter-v7.0.11) (2022-05-27) ### Bug Fixes * remove typesVersions from package.json ([#219](#219)) ([465670e](465670e)), closes [#214](#214) [#161](#161) [#214](#214) ### Trivial Changes * update dep-check command ([#221](#221)) ([5802bd3](5802bd3))
🎉 This issue has been resolved in version ipfs-unixfs-exporter-v7.0.11 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
If we don't to this, we end up importing deep paths from `unixfs` in the generated types which aren't in the exports map so fail when people are compiling their dependencies. Fixes #214
) If we don't to this, we end up importing deep paths from `unixfs` in the generated types which aren't in the exports map so fail when people are compiling their dependencies. Fixes #214
🎉 This issue has been resolved in version ipfs-unixfs-importer-v10.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version ipfs-unixfs-exporter-v8.0.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
ipfs-unixfs-importer
:import
type declaration importsUnixFS
from the wrong locationImpact
unable to use
ipfs-unixfs-importer
package in typescript projects. attempting to transpile typescript project usingtsc
fails with the following error:Potential Cause
typesVersions
inpackage.json
ofipfs-unixfs
has a path mapping that checks bothtypes/*
andtypes/src/*
. RemovingtypesVersions
entirely and regenerating the type declarations yieldsunixfs: import("ipfs-unixfs").UnixFS | undefined
which solves the problem because typescript resolves the type using thetypes
property inpackage.json
. Though, i'm not sure if this is the way we want to solve the problem. I'm not sure whether downstream projects are importing types that aren't exported fromindex.d.ts
. I think ideally, using something likenpm-dts
to bundle all types into 1index.d.ts
that is made available at the root of the package tarball would remove a lot of complexity around configuring typesSomewhat related
reset
npm script needs to delete thetypes
directory in every package because it's auto-generated. not deleting them prevents types from being regeneratedThe text was updated successfully, but these errors were encountered: