Skip to content

Commit 02bdf05

Browse files
committed
make setAdditionalRegisters types more flexible
1 parent da33768 commit 02bdf05

File tree

4 files changed

+198
-212
lines changed

4 files changed

+198
-212
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@
3030
"@fleet-sdk/common": "workspace:^",
3131
"@fleet-sdk/crypto": "workspace:^",
3232
"@types/diff": "^7.0.2",
33-
"@vitest/coverage-v8": "^3.1.3",
33+
"@vitest/coverage-v8": "^3.1.4",
3434
"ergo-lib-wasm-nodejs": "^0.28.0",
3535
"fast-check": "^4.1.1",
3636
"happy-dom": "^17.4.7",
3737
"npm-run-all": "^4.1.5",
3838
"open-cli": "^8.0.0",
3939
"sigmastate-js": "0.4.6",
40-
"tsup": "^8.4.0",
40+
"tsup": "^8.5.0",
4141
"type-fest": "^4.41.0",
4242
"typescript": "^5.8.3",
4343
"vite-tsconfig-paths": "^5.1.4",
44-
"vitest": "^3.1.3"
44+
"vitest": "^3.1.4"
4545
},
4646
"engines": {
4747
"node": ">=18",

packages/core/src/builder/outputBuilder.test-d.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

packages/core/src/builder/outputBuilder.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,10 @@ export class OutputBuilder {
166166
return this;
167167
}
168168

169-
setAdditionalRegisters<T extends AdditionalRegistersInput>(
170-
registers: SequentialNonMandatoryRegisters<T>
171-
): OutputBuilder {
169+
setAdditionalRegisters(registers: NonMandatoryRegisters<ConstantInput>): OutputBuilder {
172170
const hexRegisters: NonMandatoryRegisters = {};
173171
for (const key in registers) {
174-
const r = registers[key] as ConstantInput;
172+
const r = registers[key as keyof NonMandatoryRegisters];
175173
if (!r) continue;
176174

177175
hexRegisters[key as keyof NonMandatoryRegisters] = typeof r === "string" ? r : r.toHex();
@@ -237,8 +235,6 @@ export class OutputBuilder {
237235

238236
export type ConstantInput = SConstant | HexString;
239237

240-
export type AdditionalRegistersInput = NonMandatoryRegisters<ConstantInput>;
241-
242238
export type OnlyR4Register<T = HexString> = {
243239
R4: T;
244240
} & NonMandatoryRegisters<T>;
@@ -277,19 +273,3 @@ export type R4ToR9Registers<T = HexString> = {
277273
R8: T;
278274
R9: T;
279275
} & NonMandatoryRegisters<T>;
280-
281-
export type SequentialNonMandatoryRegisters<T extends AdditionalRegistersInput> = T extends {
282-
R9: ConstantInput;
283-
}
284-
? R4ToR9Registers<ConstantInput>
285-
: T extends { R8: ConstantInput }
286-
? R4ToR8Registers<ConstantInput>
287-
: T extends { R7: ConstantInput }
288-
? R4ToR7Registers<ConstantInput>
289-
: T extends { R6: ConstantInput }
290-
? R4ToR6Registers<ConstantInput>
291-
: T extends { R5: ConstantInput }
292-
? R4ToR5Registers<ConstantInput>
293-
: T extends { R4: ConstantInput }
294-
? OnlyR4Register<ConstantInput>
295-
: T;

0 commit comments

Comments
 (0)