o1-labs / o1js

TypeScript framework for zk-SNARKs and zkApps
https://docs.minaprotocol.com/en/zkapps/how-to-write-a-zkapp
Apache License 2.0
473 stars 105 forks source link

Fix method.returns() inference #1653

Closed mitschabaude closed 1 month ago

mitschabaude commented 1 month ago

Without this PR, method return types were inferred as any, so the method.returns(Type) decorator allowed the method to return any type. Now, the return type has to match the Type value

Is this a breaking change? (no)

In my opinion, generic type parameter changes are a grey area, and we should decide case-by-case whether we consider them breaking the API:

I'm confident that we can consider this change as an example of the first case, and consider this not a breaking change.

image