Skip to content

Commit 21d0e11

Browse files
committed
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.
1 parent aae6306 commit 21d0e11

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/templates/core/functions/base64.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ function base64(str: string): string {
22
try {
33
return btoa(str);
44
} catch (err) {
5+
// @ts-ignore
56
return Buffer.from(str).toString('base64');
67
}
78
}

0 commit comments

Comments
 (0)