Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

[Types] IPFS.create() options uses Libp2pConfig instead of Libp2pOptions #3640

Closed
rvagg opened this issue Apr 26, 2021 · 4 comments · Fixed by #3657
Closed

[Types] IPFS.create() options uses Libp2pConfig instead of Libp2pOptions #3640

rvagg opened this issue Apr 26, 2021 · 4 comments · Fixed by #3657
Assignees
Labels
need/triage Needs initial labeling and prioritization

Comments

@rvagg
Copy link
Member

rvagg commented Apr 26, 2021

Ref: ceramicnetwork/js-ceramic#1194 (comment)

import type { Libp2pConfig as Libp2pOptions } from 'libp2p'

Sooo .. it looks like what's going on here is that ipfs-core is pulling in Libp2pConfig when it should be pulling in Libp2pOptions because Libp2pConfig is used for the config property inside Libp2pOptions. So in ceramicnetwork/js-ceramic#1194 I was having to pull up the elements in the libp2p.config object into libp2p to satisfy this condition. I think this should just be:

import type { Libp2pOptions } from 'libp2p'
@vasco-santos
Copy link
Member

@achingbrain
Copy link
Member

achingbrain commented Apr 27, 2021

Ah, annoying - @vasco-santos that type doesn't actually look like it's used anywhere in the file. I wish our linter would pick that up.

@vasco-santos
Copy link
Member

@achingbrain
Copy link
Member

We'd need to add a /** @type {Options} */ to https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs-core/src/components/libp2p.js#L164 otherwise it'll infer the return type instead of using the one defined in the @typedef.

That'd be fine initially but if we removed a property or something it'd just update the inferred return type rather than erroring on the change.

achingbrain added a commit that referenced this issue Apr 29, 2021
Some of the types need a little correcting.

Fixes #3640
achingbrain added a commit that referenced this issue Apr 30, 2021
Some of the types need a little correcting.

Fixes #3640
vasco-santos pushed a commit that referenced this issue Apr 30, 2021
Some of the types need a little correcting.

Fixes #3640
vasco-santos pushed a commit that referenced this issue Apr 30, 2021
Some of the types need a little correcting.

Fixes #3640
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants