Skip to content

Instantly share code, notes, and snippets.

@Sajjon
Last active March 17, 2021 11:56
Show Gist options
  • Save Sajjon/cff83c898161228a423b9457f9a8de95 to your computer and use it in GitHub Desktop.
Save Sajjon/cff83c898161228a423b9457f9a8de95 to your computer and use it in GitHub Desktop.
Chainable radix type second solution
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