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

fix: update types after feedback from ceramic #3657

Merged
merged 3 commits into from
Apr 30, 2021
Merged

Conversation

achingbrain
Copy link
Member

Some of the types need a little correcting.

Fixes #3640

@achingbrain achingbrain merged commit 0ddbb1b into master Apr 30, 2021
@achingbrain achingbrain deleted the fix/update-types branch April 30, 2021 08:44
vasco-santos pushed a commit that referenced this pull request Apr 30, 2021
Some of the types need a little correcting.

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

Fixes #3640
@@ -117,7 +117,7 @@ export interface Options {
* in Node.js, [`libp2p-browser.js`](../src/core/runtime/libp2p-browser.js) in
* browsers.
*/
libp2p?: Libp2pOptions | Libp2pFactoryFn
libp2p?: Partial<Libp2pOptions> | Libp2pFactoryFn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about Partial<>.
What's the reason for doing this here, is Libp2pOptions too constrained, or is this what getLibp2pOptions() is doing, filling out defaults for the required?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The libp2p option type has a bunch of required fields, so make it a partial so we can accept an incomplete config object from the user. Otherwise we’d have to duplicate the type to mark the fields optional.

It’s not perfect as it’s non-recursive so if that’s an issue maybe we can relax the required fields in libp2p itself in the future.

This was referenced Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Types] IPFS.create() options uses Libp2pConfig instead of Libp2pOptions
2 participants