From a9cb33db04534211cf103d403e61020e8ea10026 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 4 Jun 2018 09:47:54 +1000 Subject: [PATCH] Treat host as possibly undefined for base64encode/base64decode Fixes: #24638 --- src/compiler/utilities.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 753ab32321d..e17f34cd05a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3674,15 +3674,15 @@ namespace ts { return output; } - export function base64encode(host: { base64encode?(input: string): string }, input: string): string { - if (host.base64encode) { + export function base64encode(host: { base64encode?(input: string): string } | undefined, input: string): string { + if (host && host.base64encode) { return host.base64encode(input); } return convertToBase64(input); } - export function base64decode(host: { base64decode?(input: string): string }, input: string): string { - if (host.base64decode) { + export function base64decode(host: { base64decode?(input: string): string } | undefined, input: string): string { + if (host && host.base64decode) { return host.base64decode(input); } const length = input.length;