From 21d0e116e71f9d68c63f56b9909adf964bafe490 Mon Sep 17 00:00:00 2001 From: Samuel Rossille Date: Sun, 19 Dec 2021 11:05:42 +0100 Subject: [PATCH] Fix client compilation error in base64() Context : The base64 function tries using the btoa function and falls back to using Buffer if btoa is not available. Problem : In the context of a dom, you have btoa, and you may not necessarily have Buffer, and in the case the fallback branch creates a compilation error "TS2591: Cannot find name 'Buffer'." Solution : Add a @ts-ignore in the fallback branch because we will always have either btoa or Buffer available in the forseable future. --- src/templates/core/functions/base64.hbs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/core/functions/base64.hbs b/src/templates/core/functions/base64.hbs index 6319c2c9..bca506a1 100644 --- a/src/templates/core/functions/base64.hbs +++ b/src/templates/core/functions/base64.hbs @@ -2,6 +2,7 @@ function base64(str: string): string { try { return btoa(str); } catch (err) { + // @ts-ignore return Buffer.from(str).toString('base64'); } }