mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Merge pull request #24641 from kitsonk/issue-24638-host-possibly-undefined
Treat host as possibly undefined for base64encode/base64decode
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user