New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
o1js is not quite compatible with NodeNext TSC module resolution #1447
Comments
oh that's bad! looking into it |
Btw, I don't get what exactly makes |
Another long-shot idea is that the cycle of imports between
|
Ok, I made a lot of progress debugging, will leave this draft PR here for now: #1448 The key change in that PR is to export With that PR, the following snippet type-checks. Note the many "unused" type imports, each of which is necessary to "name" the inferred type of import {
Bool,
Field,
ZkProgram,
Proof,
InternalBool,
InternalField,
Cache,
GateType,
Gate,
FieldVar,
FieldConst,
} from "o1js";
export { HelloProgram };
const HelloProgram = ZkProgram({
name: "hello-program",
publicInput: Field,
publicOutput: Bool,
methods: {
addition: {
privateInputs: [Field, Field],
method(sum: Field, a: Field, b: Field) {
return a.add(b).equals(sum);
},
},
},
}); alternatively, this could be used: import { Bool, Field, ZkProgram } from "o1js";
import type * as _o1js from "o1js"; // for type naming
export { HelloProgram };
const HelloProgram = ZkProgram({
name: "hello-program",
publicInput: Field,
publicOutput: Bool,
methods: {
addition: {
privateInputs: [Field, Field],
method(sum: Field, a: Field, b: Field) {
return a.add(b).equals(sum);
},
},
},
}); |
That's not ideal, but it works :) When is the release? |
not sure if we want to release that yet |
See also the discussion on discord https://discord.com/channels/484437221055922177/1205086733121888266 I've encountered many issues with o1js and nodenext in my MinaNFT library, and after trying many ways to resolve it, I finally decided to wait for TypeScript bug resolution microsoft/TypeScript#47663 and microsoft/TypeScript#48212. I believe that the bug is on TypeScript side, and only some temporary workarounds can be made in the o1js or minanft library. |
We should check if TypeScript 5.5 which includes microsoft/TypeScript#42873 resolves this |
@mitschabaude Nope. Does not work. Now even Updated the repro repo with the newest TS. |
If you use
NodeNext
module resolution setting,an instance of
ZkProgram
can not be exported. TSC complains it can not actually infer types.See reproduction case: https://github.com/ukstv/o1js-nodenext-repro
Probably related issue: microsoft/TypeScript#47663
The text was updated successfully, but these errors were encountered: