demergent-labs / azle

A WebAssembly runtime for TypeScript and JavaScript on ICP
MIT License
204 stars 37 forks source link

Aliases to `void` are converted to `null` #1084

Open dansteren opened 1 year ago

dansteren commented 1 year ago

Given the following canister

type VoidAlias = Alias<void>;

$query;
export function voidAliasTest(): VoidAlias {}

When running dfx deploy Then the following candid file is expected to be generated:

service : () -> { voidAliasTest : () -> () query }

Currently, it actually generates:

service : () -> { voidAliasTest : () -> (null) query }

Note There is a broken test for this in the rust_type_conversions example that should be updated as part of this ticket.

bdemann commented 1 year ago

Important With how aliases for void are done right now this is technically not a problem. The problematic code still exists but it shouldn't ever run because aliases to void just get replaced with void thanks the the alias table. When this issue https://github.com/demergent-labs/azle/issues/1118 is resolved I suspect that this ticket will become an issue again.

lastmjs commented 11 months ago

We should check to make sure we can do the equivalent in Azle 0.18+