From 2799332966aa9a49f0920b3203393ea2efe9cdae Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 15 May 2024 10:49:03 +0200 Subject: [PATCH 1/3] fix method.returns inference --- src/lib/mina/zkapp.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/mina/zkapp.ts b/src/lib/mina/zkapp.ts index c4ecefb141..84e73cc286 100644 --- a/src/lib/mina/zkapp.ts +++ b/src/lib/mina/zkapp.ts @@ -19,6 +19,7 @@ import { import { cloneCircuitValue, FlexibleProvablePure, + InferProvable, } from '../provable/types/struct.js'; import { Provable, @@ -170,12 +171,14 @@ function method( * } * ``` */ -method.returns = function ( - returnType: Provable -) { +method.returns = function < + K extends string, + T extends SmartContract, + R extends Provable +>(returnType: R) { return function decorateMethod( target: T & { - [k in K]: (...args: any) => Promise; + [k in K]: (...args: any) => Promise>; }, methodName: K & string & keyof T, descriptor: PropertyDescriptor From d6bd723d3b54a54de43a5715a06b012b0eb098a0 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 15 May 2024 10:52:15 +0200 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3215c7dd3d..0988b8eab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixes - Fix absolute imports which prevented compilation in some TS projects that used o1js https://github.com/o1-labs/o1js/pull/1628 +- Fix type inference for `method.returns(Type)`, to require a matching return signature https://github.com/o1-labs/o1js/pull/1653 ## [1.1.0](https://github.com/o1-labs/o1js/compare/1ad7333e9e...4a17de857) - 2024-04-30 From 32955a8e17d04343e9531eef402626727bf6c500 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 15 May 2024 15:44:55 +0200 Subject: [PATCH 3/3] fix changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edef6f20df..de4d0dd104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased](https://github.com/o1-labs/o1js/compare/6a1012162...HEAD) +### Fixes + +- Fix type inference for `method.returns(Type)`, to require a matching return signature https://github.com/o1-labs/o1js/pull/1653 + ## [1.2.0](https://github.com/o1-labs/o1js/compare/4a17de857...6a1012162) - 2024-05-14 ### Added @@ -41,7 +45,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixes - Fix absolute imports which prevented compilation in some TS projects that used o1js https://github.com/o1-labs/o1js/pull/1628 -- Fix type inference for `method.returns(Type)`, to require a matching return signature https://github.com/o1-labs/o1js/pull/1653 ## [1.1.0](https://github.com/o1-labs/o1js/compare/1ad7333e9e...4a17de857) - 2024-04-30