Skip to content

Commit d956af2

Browse files
authored
Transform all u8 arrays by default (#362)
* Transform all u8 arrays by default The current behaviour confuses devs because some `u8` arrays are being turned into `BytesTypeNode` but not others based on their size. This PR fixes this by transforming all fixed-size arrays of `u8` numbers into a `FixedSizeTypeNode` of `BytesTypeNode`. * Update changesets
1 parent e255d74 commit d956af2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@codama/visitors': minor
3+
'@codama/nodes-from-anchor': minor
4+
---
5+
6+
Transform all u8 arrays by default in `transformU8ArraysToBytesVisitor`

packages/visitors/src/transformU8ArraysToBytesVisitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@codama/nodes';
1010
import { extendVisitor, nonNullableIdentityVisitor, pipe, visit } from '@codama/visitors-core';
1111

12-
export function transformU8ArraysToBytesVisitor(sizes: number[] | '*' = [32, 64]) {
12+
export function transformU8ArraysToBytesVisitor(sizes: number[] | '*' = '*') {
1313
const hasRequiredSize = (count: ArrayTypeNode['count']): boolean => {
1414
if (!isNode(count, 'fixedCountNode')) return false;
1515
return sizes === '*' || sizes.includes(count.value);

0 commit comments

Comments
 (0)