bool

The CandidType object bool corresponds to the Candid type bool, is inferred to be a TypeScript boolean, and will be decoded into a JavaScript Boolean at runtime.

TypeScript or JavaScript:

import { bool, Canister, query } from 'azle/experimental';

export default Canister({
    getBool: query([], bool, () => {
        return true;
    }),
    printBool: query([bool], bool, (bool) => {
        console.log(typeof bool);
        return bool;
    })
});

Candid:

service : () -> {
    getBool : () -> (bool) query;
    printBool : (bool) -> (bool) query;
}

dfx:

dfx canister call candid_canister printBool '(true)'
(true)