Skip to content

noir_codegen generates invalid TypeScript for void functions #9840

@yash25198

Description

@yash25198

Aim

The noir_codegen tool generates syntactically incorrect TypeScript code for Noir functions that don't return a value.

Expected Behavior

Functions with no return value should generate:

  • Return type: Promise<void>
  • No return statement or just return;

Bug

Functions with no return value incorrectly generate:

  • Return type: Promise<null>
  • Return statement: return returnValue as null;

To Reproduce

  1. Create a Noir function with no return value:
#[export]
pub fn test(x: u64) {
    assert(x > 0);
}
  1. Run noir_codegen
  2. Observe the generated TypeScript has Promise<null> and return returnValue as null;

Workaround

Yes

Workaround Description

I am running a shell script in my workflow to remove this line return returnValue as null;

Additional Context

No response

Project Impact

Nice-to-have

Blocker Context

This prevents the generated TypeScript from compiling, breaking the developer workflow.

Nargo Version

1.0.0-beta.12

NoirJS Version

1.0.0-beta.11

Proving Backend Tooling & Version

bb 0.87.0

Would you like to submit a PR for this Issue?

None

Support Needs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions