-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: update types after feedback from ceramic #3657
Conversation
Some of the types need a little correcting. Fixes #3640
Some of the types need a little correcting. Fixes #3640
Some of the types need a little correcting. Fixes #3640
* browsers. | ||
*/ | ||
libp2p?: Libp2pOptions | Libp2pFactoryFn | ||
libp2p?: Partial<Libp2pOptions> | Libp2pFactoryFn |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Some of the types need a little correcting.
Fixes #3640