Treat host as possibly undefined for base64encode/base64decode

Fixes: #24638
This commit is contained in:
Kitson Kelly 2018-06-04 09:47:54 +10:00
parent 667de4bbb9
commit a9cb33db04
No known key found for this signature in database
GPG Key ID: 545CADD213D34063

View File

@ -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;