Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ export default tseslint.config(
"unicorn/no-useless-spread": "off",
},
}
);
);
16 changes: 15 additions & 1 deletion src/builder/struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,23 @@ import { Field } from '../schema.js';
import { Builder } from '../builder.js';
import { Struct, TypeMap } from '../type.js';

/** @ignore */
type StructValue<T extends TypeMap = any> = Struct<T>['TValue'] | { [P in keyof T]: T[P]['TValue'] };

@trxcllnt trxcllnt Nov 25, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed because of a Typescript version bump? This used to work because the mapping is part of the Struct<T>['TValue'] aka StructRowProxy<T>.


/** @ignore */
export class StructBuilder<T extends TypeMap = any, TNull = any> extends Builder<Struct<T>, TNull> {
public setValue(index: number, value: Struct<T>['TValue']) {
public append(value: StructValue<T> | TNull) {
return this.set(this.length, value as any);
}

public set(index: number, value: StructValue<T> | TNull) {
if (this.setValid(index, this.isValid(value as any))) {
this.setValue(index, value as StructValue<T>);
}
return this;
}

public setValue(index: number, value: StructValue<T>) {
const { children, type } = this;
switch (Array.isArray(value) || value.constructor) {
case true: return type.children.forEach((_, i) => children[i].set(index, value[i]));
Expand Down
1 change: 1 addition & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": "../",
"allowJs": true,
"declaration": false,
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this change?

Original file line number Diff line number Diff line change
Expand Up @@ -6649,4 +6649,4 @@ yocto-queue@^0.1.0:
zstd-codec@0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/zstd-codec/-/zstd-codec-0.1.5.tgz#c180193e4603ef74ddf704bcc835397d30a60e42"
integrity sha512-v3fyjpK8S/dpY/X5WxqTK3IoCnp/ZOLxn144GZVlNUjtwAchzrVo03h+oMATFhCIiJ5KTr4V3vDQQYz4RU684g==
integrity sha512-v3fyjpK8S/dpY/X5WxqTK3IoCnp/ZOLxn144GZVlNUjtwAchzrVo03h+oMATFhCIiJ5KTr4V3vDQQYz4RU684g==

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you revert this change?