Skip to content
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

feat!: remove inspect symbol from public interface #247

Closed
wants to merge 2 commits into from

Conversation

wemeetagain
Copy link
Contributor

The inspect symbol being part of the public interfaces causes type incompatibilities between otherwise compatible versions of this library.
Typescript treats the symbol as unique, even though the same symbol will be used across versions.

Eg:
Library A uses @multiformats/[email protected]
Library B uses A and @multiformats/[email protected]

The types will not match and there will be a type error:

error TS2741: Property '[inspect]' is missing in type 'import("/path/to/B/node_modules/@multiformats/multiaddr/dist/src/index").Multiaddr' but required in type 'import("/path/to/B/node_modules/A/node_modules/@multiformats/multiaddr/dist/src/index").Multiaddr'.

The inspect symbol being part of the public interfaces causes type incompatibilities between otherwise compatible versions of this library.
Typescript treats the symbol as unique, even though the same symbol will be used across versions.

Eg:
Library A uses @multiformats/[email protected]
Library B uses A and @multiformats/[email protected]

The types will not match and there will be a type error:
```
error TS2741: Property '[inspect]' is missing in type 'import("/path/to/B/node_modules/@multiformats/multiaddr/dist/src/index").Multiaddr' but required in type 'import("/path/to/B/node_modules/A/node_modules/@multiformats/multiaddr/dist/src/index").Multiaddr'.
```
@wemeetagain
Copy link
Contributor Author

cc @achingbrain

@achingbrain
Copy link
Member

How have you ended up with multiple semver-compatible versions of @multiformats/multiaddr in your dep tree when they should be deduped and hoisted?

Are your deps shrinkwrapped?

@wemeetagain
Copy link
Contributor Author

We're using yarn. I guess it doesn't dedupe and hoist

@achingbrain
Copy link
Member

achingbrain commented Jun 11, 2022

I think you have to run it as a separate command.

That file says:

Duplication happens when Yarn can't unlock dependencies that have already been locked inside the lockfile.

What happens if you delete all of your project lockfiles and reinstall - do you still get duplicate @multiformats/multiaddr deps?

@wemeetagain
Copy link
Contributor Author

Sure enough... I don't get duplicate @multiformats/multiaddr deps.

Still think this is a good PR. (or i guess alternatively, we should create a Multiaddr interface like we have for PeerId)

@wemeetagain
Copy link
Contributor Author

related to #202

@achingbrain
Copy link
Member

Superseded by #274

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