diff --git a/packages/examples/src/scripts/countdown.ts b/packages/examples/src/scripts/countdown.ts index fa7c2e25c..f65306204 100644 --- a/packages/examples/src/scripts/countdown.ts +++ b/packages/examples/src/scripts/countdown.ts @@ -127,7 +127,7 @@ WoT.produce({ "startCountdown", async (params: WoT.InteractionOutput, options): Promise => { let initValue = 100; - if (params) { + if (params !== undefined) { const value = await params.value(); if (typeof value === "number") { initValue = value as number; @@ -147,7 +147,7 @@ WoT.produce({ thing.setActionHandler( "stopCountdown", async (params: WoT.InteractionOutput, options): Promise => { - if (params) { + if (params !== undefined) { const value = await params.value(); if (typeof value === "string" && countdowns.has(value)) { const as = countdowns.get(value); @@ -170,7 +170,7 @@ WoT.produce({ thing.setActionHandler( "monitorCountdown", async (params: WoT.InteractionOutput, options): Promise => { - if (params) { + if (params !== undefined) { const value = await params.value(); if (typeof value === "string" && countdowns.has(value)) { const as = countdowns.get(value); diff --git a/packages/examples/src/scripts/smart-coffee-machine-client.ts b/packages/examples/src/scripts/smart-coffee-machine-client.ts index 05e745c35..767cba1ef 100644 --- a/packages/examples/src/scripts/smart-coffee-machine-client.ts +++ b/packages/examples/src/scripts/smart-coffee-machine-client.ts @@ -61,7 +61,7 @@ WoTHelpers.fetch("http://127.0.0.1:8080/smart-coffee-machine").then(async (td) = uriVariables: { drinkId: "latte", size: "l", quantity: 3 }, }); const makeCoffeep = (await makeCoffee?.value()) as Record; - if (makeCoffeep.result) { + if (makeCoffeep.result !== undefined) { log("Enjoy your drink!", makeCoffeep); } else { log("Failed making your drink:", makeCoffeep); diff --git a/packages/examples/src/scripts/smart-coffee-machine.ts b/packages/examples/src/scripts/smart-coffee-machine.ts index 896ebe947..17f11a225 100644 --- a/packages/examples/src/scripts/smart-coffee-machine.ts +++ b/packages/examples/src/scripts/smart-coffee-machine.ts @@ -396,7 +396,7 @@ Assumes one medium americano if not specified, but time and mode are mandatory f const paramsp = (await params.value()) as Record; // : any = await Helpers.parseInteractionOutput(params); // Check if uriVariables are provided - if (paramsp && typeof paramsp === "object" && "time" in paramsp && "mode" in paramsp) { + if (paramsp !== undefined && typeof paramsp === "object" && "time" in paramsp && "mode" in paramsp) { // Use default values if not provided paramsp.drinkId = "drinkId" in paramsp ? paramsp.drinkId : "americano"; paramsp.size = "size" in paramsp ? paramsp.size : "m";