Skip to content

Commit

Permalink
feat(types): utility for Base64 encoding Any json
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Apr 22, 2024
1 parent ea0ca4d commit dba4089
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/cosmic-proto/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ export const typedJson = <T extends keyof Proto3Shape>(
...obj,
} as TypedJson<T>;
};

// TODO make codegen toJSON() return these instead of unknown
/**
* Proto Any with arrays encoded as base64
*/
export type Base64Any<T> = {
[Prop in keyof T]: T[Prop] extends Uint8Array ? string : T[Prop];
};

0 comments on commit dba4089

Please sign in to comment.