Skip to content

Commit 5f6660b

Browse files
authored
Merge pull request #24641 from kitsonk/issue-24638-host-possibly-undefined
Treat host as possibly undefined for base64encode/base64decode
2 parents 3446a79 + a9cb33d commit 5f6660b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/compiler/utilities.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,15 +3674,15 @@ namespace ts {
36743674
return output;
36753675
}
36763676

3677-
export function base64encode(host: { base64encode?(input: string): string }, input: string): string {
3678-
if (host.base64encode) {
3677+
export function base64encode(host: { base64encode?(input: string): string } | undefined, input: string): string {
3678+
if (host && host.base64encode) {
36793679
return host.base64encode(input);
36803680
}
36813681
return convertToBase64(input);
36823682
}
36833683

3684-
export function base64decode(host: { base64decode?(input: string): string }, input: string): string {
3685-
if (host.base64decode) {
3684+
export function base64decode(host: { base64decode?(input: string): string } | undefined, input: string): string {
3685+
if (host && host.base64decode) {
36863686
return host.base64decode(input);
36873687
}
36883688
const length = input.length;

0 commit comments

Comments
 (0)