Skip to content

Commit

Permalink
Use readonly for tuple arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Mar 27, 2024
1 parent 6dfc64b commit 46c1020
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/renderers/js-experimental/getTypeManifestVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export function getTypeManifestVisitor(input: {
const items = tupleType.items.map((item) => visit(item, self));
const mergedManifest = mergeManifests(
items,
(types) => `[${types.join(', ')}]`,
(types) => `readonly [${types.join(', ')}]`,
(codecs) => `[${codecs.join(', ')}]`
);
mergedManifest.encoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {

export type EscrowAuthority =
| { __kind: 'TokenOwner' }
| { __kind: 'Creator'; fields: [Address] };
| { __kind: 'Creator'; fields: readonly [Address] };

export type EscrowAuthorityArgs = EscrowAuthority;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ import {

export type ExtendedPayload = {
map: Map<PayloadKey, PayloadType>;
args: [number, string];
args: readonly [number, string];
};

export type ExtendedPayloadArgs = {
map: Map<PayloadKeyArgs, PayloadTypeArgs>;
args: [number, string];
args: readonly [number, string];
};

export function getExtendedPayloadEncoder(): Encoder<ExtendedPayloadArgs> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ import {

/** This is a union of all the possible payload types. */
export type PayloadType =
| { __kind: 'Pubkey'; fields: [Address] }
| { __kind: 'Pubkey'; fields: readonly [Address] }
| { __kind: 'Seeds'; seeds: Array<Uint8Array> }
| { __kind: 'MerkleProof'; leaf: Uint8Array; proof: Array<Uint8Array> }
| { __kind: 'Number'; fields: [bigint] };
| { __kind: 'Number'; fields: readonly [bigint] };

export type PayloadTypeArgs =
| { __kind: 'Pubkey'; fields: [Address] }
| { __kind: 'Pubkey'; fields: readonly [Address] }
| { __kind: 'Seeds'; seeds: Array<Uint8Array> }
| { __kind: 'MerkleProof'; leaf: Uint8Array; proof: Array<Uint8Array> }
| { __kind: 'Number'; fields: [number | bigint] };
| { __kind: 'Number'; fields: readonly [number | bigint] };

export function getPayloadTypeEncoder(): Encoder<PayloadTypeArgs> {
return getDiscriminatedUnionEncoder([
Expand Down

0 comments on commit 46c1020

Please sign in to comment.