Skip to content

Commit

Permalink
fix: Fix keybundle generic
Browse files Browse the repository at this point in the history
Fix keybundle method with generic content types
  • Loading branch information
Alex Risch authored and Alex Risch committed May 28, 2024
1 parent 1ffb0be commit 358e63f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions example/src/types/typeTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,27 @@ export const typeTests = async () => {
await reactionConvo.send({
text: 'text',
})
const keyBundle = await reactionClient.exportKeyBundle()
const keyBundleReactionClient = await Client.createFromKeyBundle<
typeof supportedCodecs
>(keyBundle, {
codecs: supportedCodecs,
})
const reactionKeyBundleConvo = (
await keyBundleReactionClient.conversations.list()
)[0]
await reactionKeyBundleConvo.send({
// @ts-expect-error
sdfsdf: 'sdfsdf',
})
await reactionConvo.send({
reaction: {
action: 'added',
content: '💖',
reference: '123',
schema: 'unicode',
},
})

const messages = await reactionConvo.messages()
const content = messages[0].content()
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class Client<
>(
keyBundle: string,
opts?: Partial<ClientOptions> & { codecs?: ContentCodecs }
): Promise<Client<DefaultContentTypes>> {
): Promise<Client<ContentCodecs>> {
const options = defaultOptions(opts)
const address = await XMTPModule.createFromKeyBundle(
keyBundle,
Expand Down

0 comments on commit 358e63f

Please sign in to comment.