Skip to content

Commit 2d95621

Browse files
committed
fix build
1 parent 6f93838 commit 2d95621

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

src/url/builder.ts

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { ImageKitOptions, UrlOptions } from "../interfaces";
2-
import { Transformation } from "../interfaces/Transformation";
3-
import transformationUtils from "../utils/transformation";
4-
import { safeBtoa } from "../utils/transformation";
2+
import { ImageOverlay, SolidColorOverlay, SubtitleOverlay, TextOverlay, Transformation, VideoOverlay } from "../interfaces/Transformation";
3+
import transformationUtils, { safeBtoa } from "../utils/transformation";
54
const TRANSFORMATION_PARAMETER = "tr";
65

76
function removeTrailingSlash(str: string) {
@@ -89,33 +88,48 @@ function processOverlay(overlay: Transformation["overlay"]): string | undefined
8988
switch (type) {
9089
case "text":
9190
entries.push("l-text");
92-
if (overlay.text) {
93-
entries.push(`ie-${encodeURIComponent(safeBtoa(overlay.text))}`);
91+
{
92+
const textOverlay = overlay as TextOverlay;
93+
if (textOverlay.text) {
94+
entries.push(`ie-${encodeURIComponent(safeBtoa(textOverlay.text))}`);
95+
}
9496
}
9597
break;
9698
case "image":
9799
entries.push("l-image");
98-
if (overlay.input) {
99-
entries.push(`i-${overlay.input}`);
100+
{
101+
const imageOverlay = overlay as ImageOverlay;
102+
if (imageOverlay.input) {
103+
entries.push(`i-${imageOverlay.input}`);
104+
}
100105
}
101106
break;
102107
case "video":
103108
entries.push("l-video");
104-
if (overlay.input) {
105-
entries.push(`i-${overlay.input}`);
109+
{
110+
const videoOverlay = overlay as VideoOverlay;
111+
if (videoOverlay.input) {
112+
entries.push(`i-${videoOverlay.input}`);
113+
}
106114
}
107115
break;
108116
case "subtitle":
109117
entries.push("l-subtitle");
110-
if (overlay.input) {
111-
entries.push(`i-${overlay.input}`);
118+
{
119+
const subtitleOverlay = overlay as SubtitleOverlay;
120+
if (subtitleOverlay.input) {
121+
entries.push(`i-${subtitleOverlay.input}`);
122+
}
112123
}
113124
break;
114125
case "solidColor":
115126
entries.push("l-image");
116127
entries.push(`i-ik_canvas`);
117-
if (overlay.color) {
118-
entries.push(`bg-${overlay.color}`);
128+
{
129+
const solidColorOverlay = overlay as SolidColorOverlay;
130+
if (solidColorOverlay.color) {
131+
entries.push(`bg-${solidColorOverlay.color}`);
132+
}
119133
}
120134
break;
121135
}

0 commit comments

Comments
 (0)