Last active
March 17, 2021 11:56
-
-
Save Sajjon/cff83c898161228a423b9457f9a8de95 to your computer and use it in GitHub Desktop.
Chainable radix type second solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const create = (): RadixT => { | |
/// REST OF METHOD OMITTED | |
// ... | |
// ... | |
// ... | |
/// REST OF METHOD OMITTED | |
let radix: RadixT = (undefined as unknown) as RadixT | |
const connect = (url: URL): RadixT => { | |
withNodeConnection(of({ url })) | |
return radix | |
} | |
radix = { | |
// we forward the full `RadixAPI`, but we also provide some convenience methods based on active account/address. | |
...api, | |
// REST OF METHODS OMITTED | |
connect, | |
// REST OF METHODS OMITTED | |
} | |
return radix | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment