diff --git a/typescript/lambda-greeter/src/app.ts b/typescript/lambda-greeter/src/app.ts index c7529bde..6c9b0357 100644 --- a/typescript/lambda-greeter/src/app.ts +++ b/typescript/lambda-greeter/src/app.ts @@ -19,7 +19,7 @@ const doGreetAndRemember = async ( ctx: restate.RestateContext, name: string ) => { - let seen = (await ctx.get("seen")) || 0; + let seen = (await ctx.get("seen")) ?? 0; seen += 1; ctx.set("seen", seen); diff --git a/typescript/ticket-reservation/src/ticket_db.ts b/typescript/ticket-reservation/src/ticket_db.ts index 2076f1e2..22eec96e 100644 --- a/typescript/ticket-reservation/src/ticket_db.ts +++ b/typescript/ticket-reservation/src/ticket_db.ts @@ -19,7 +19,7 @@ enum TicketStatus { const doReserveTicket = async (ctx: restate.RpcContext) => { const status = - (await ctx.get("status")) || TicketStatus.Available; + (await ctx.get("status")) ?? TicketStatus.Available; if (status === TicketStatus.Available) { ctx.set("status", TicketStatus.Reserved); @@ -31,7 +31,7 @@ const doReserveTicket = async (ctx: restate.RpcContext) => { const doUnreserveTicket = async (ctx: restate.RpcContext) => { const status = - (await ctx.get("status")) || TicketStatus.Available; + (await ctx.get("status")) ?? TicketStatus.Available; if (status === TicketStatus.Sold) { return false; @@ -43,7 +43,7 @@ const doUnreserveTicket = async (ctx: restate.RpcContext) => { const doMarkAsSold = async (ctx: restate.RpcContext) => { const status = - (await ctx.get("status")) || TicketStatus.Available; + (await ctx.get("status")) ?? TicketStatus.Available; if (status === TicketStatus.Reserved) { ctx.set("status", TicketStatus.Sold); diff --git a/typescript/ticket-reservation/src/user_session.ts b/typescript/ticket-reservation/src/user_session.ts index 51098cc5..58b59e1d 100644 --- a/typescript/ticket-reservation/src/user_session.ts +++ b/typescript/ticket-reservation/src/user_session.ts @@ -23,7 +23,7 @@ const doAddTicket = async ( if (reservation_response) { // add ticket to user session items - const tickets = (await ctx.get("items")) || []; + const tickets = (await ctx.get("items")) ?? []; tickets.push(ticketId); ctx.set("items", tickets); @@ -42,7 +42,7 @@ const doExpireTicket = async ( ticketId: string ) => { ctx.send(ticketDbApi).unreserve(ticketId); - const tickets = (await ctx.get("items")) || []; + const tickets = (await ctx.get("items")) ?? []; const index = tickets.findIndex((id) => id === ticketId);