Skip to content

Commit

Permalink
Fix types resolution in utils.ts (#13)
Browse files Browse the repository at this point in the history
* Fixed types resolution in utils.ts

* Updated versions
  • Loading branch information
KyrylR authored Sep 5, 2024
1 parent b83e5b5 commit 08c4b88
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solarity/zktype",
"version": "0.3.0",
"version": "0.3.1",
"description": "Unleash TypeScript bindings for Circom circuits",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions src/core/templates/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export function normalizePublicSignals(
): any {
let index = 0;
return signalNames.reduce((acc: any, signalName) => {
const dimensions = getSignalDimensions(signalName);
const size = dimensions.reduce((a, b) => a * b, 1);
const dimensions: number[] = getSignalDimensions(signalName);
const size: number = dimensions.reduce((a, b) => a * b, 1);

acc[signalName] = reshape(publicSignals.slice(index, index + size), dimensions);
index += size;
Expand All @@ -29,9 +29,9 @@ function reshape(array: number[], dimensions: number[]): any {
}

const [first, ...rest] = dimensions;
const size = rest.reduce((a, b) => a * b, 1);
const size: number = rest.reduce((a, b) => a * b, 1);

const result = [];
const result: any[] = [];
for (let i = 0; i < first; i++) {
result.push(reshape(array.slice(i * size, (i + 1) * size), rest));
}
Expand Down

0 comments on commit 08c4b88

Please sign in to comment.