-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Keystore types #524
Conversation
if (codecs.req) { | ||
const reqBytes = codecs.req.encode(req).finish() | ||
if (rpc.req) { | ||
const encoder = rpc.req.encode as SnapKeystoreApiRequestEncoders[T] |
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.
tsc
needs an assist here to narrow the type
@@ -42,20 +53,21 @@ export async function snapRPC<Req, Res>( | |||
throw new Error('Unexpected array response') | |||
} | |||
|
|||
return codecs.res.decode(b64Decode(responseString)) | |||
const decoder = rpc.res.decode as SnapKeystoreApiResponseDecoders[T] |
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.
same as above: tsc
needs an assist here to narrow the type
da2aa99
to
d6c9d3b
Compare
Deploying with Cloudflare Pages
|
d6c9d3b
to
2f67978
Compare
2f67978
to
3ea9501
Compare
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.
This is some very impressive Typescript wrangling.
🎉 This PR is included in version 11.3.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
in this PR:
Keystore
interfacethese new types allow for a single source of truth for keystore functionality and their associated types. updating a keystore's RPC definitions will automatically update its types.
i decided to export all the derivative types as well so that integrators have them. they are invaluable for creating type-safe custom keystores and their handlers.