Skip to content

Commit fdfa8da

Browse files
committed
Supported Transforms updated types
1 parent 635b70c commit fdfa8da

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

libs/constants/supportedTransforms.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @see {@link https://docs.imagekit.io/features/image-transformations}
33
*/
4-
const supportedTransforms: { [key: string]: string } = {
4+
const supportedTransforms = {
55
/**
66
* @see {@link https://docs.imagekit.io/features/image-transformations/resize-crop-and-other-transformations#width-w}
77
*/
@@ -286,4 +286,5 @@ const supportedTransforms: { [key: string]: string } = {
286286
original: "orig",
287287
};
288288

289-
export default supportedTransforms;
289+
export default supportedTransforms as { [key: string]: string };
290+
export type SupportedTransformsType = keyof typeof supportedTransforms;

libs/interfaces/Transformation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import supportedTransforms from "../constants/supportedTransforms";
1+
import { SupportedTransformsType } from "../constants/supportedTransforms";
22

33
export type TransformationPosition = "path" | "query";
44

55
export type Transformation = Partial<
66
| {
7-
[key in keyof typeof supportedTransforms]: string | boolean | number;
7+
[key in SupportedTransformsType]: string | boolean | number;
88
}
9-
| { [key: string]: string | string | boolean | number }
9+
| { [key: string]: string | boolean | number }
1010
>;

libs/url/builder.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ const buildURL = function (opts: FinalUrlOptions): string {
113113
return url.format(urlObject);
114114
};
115115

116-
function constructTransformationString(transformation: Array<Transformation> | undefined) {
116+
function constructTransformationString(inputTransformation: Array<Transformation> | undefined) {
117+
118+
const transformation = inputTransformation as Array<{ [key: string]: string | boolean | number }> | undefined;
117119
if (!Array.isArray(transformation)) {
118120
return "";
119121
}

0 commit comments

Comments
 (0)