mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Treat host as possibly undefined for base64encode/base64decode
Fixes: #24638
This commit is contained in:
parent
667de4bbb9
commit
a9cb33db04
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user