Skip to content

Commit 2eb5262

Browse files
ANKUR DWIVEDIANKUR DWIVEDI
authored andcommitted
updated ikContextprops
1 parent e30d368 commit 2eb5262

2 files changed

Lines changed: 28 additions & 12 deletions

File tree

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
1-
import { UrlOptionsPath, UrlOptionsSrc } from 'imagekit-javascript/dist/src/interfaces/UrlOptions';
2-
import { InferProps } from 'prop-types';
1+
import { UrlOptionsPath, UrlOptionsSrc } from "imagekit-javascript/dist/src/interfaces/UrlOptions";
2+
import { InferProps } from "prop-types";
33
import COMMON_PROPS from "../IKContext/props";
4-
import Props from './props';
4+
import Props from "./props";
55

66
const COMBINED_IMAGE_PROP_TYPES = {
7-
...COMMON_PROPS,
8-
...Props
7+
...COMMON_PROPS,
8+
...Props,
9+
};
10+
11+
type Lqip = {
12+
active?: boolean;
13+
quality?: number;
14+
threshold?: number;
15+
blur?: number;
16+
raw?: string;
17+
} | null;
18+
19+
export type IKImageProps = Omit<InferProps<typeof COMBINED_IMAGE_PROP_TYPES>, "src" | "path" | "lqip"> &
20+
(UrlOptionsPath | UrlOptionsSrc) &
21+
React.ImgHTMLAttributes<HTMLImageElement> & {
22+
lqip?: Lqip;
23+
loading?: 'lazy';
924
};
10-
11-
export type IKImageProps = Omit<InferProps<typeof COMBINED_IMAGE_PROP_TYPES>, 'src' | 'path'> & (UrlOptionsPath | UrlOptionsSrc) & React.ImgHTMLAttributes<HTMLImageElement>;
1225

13-
export type IKImageBaseProps = InferProps<typeof Props>;
14-
15-
export default COMBINED_IMAGE_PROP_TYPES;
26+
export type IKImageBaseProps = Omit<InferProps<typeof Props>, "lqip"> & {
27+
lqip?: Lqip;
28+
loading?: 'lazy';
29+
};
30+
31+
export default COMBINED_IMAGE_PROP_TYPES;

src/components/IKUpload/props.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const Props = {
5757
overwriteAITags: PropTypes.bool,
5858
overwriteTags: PropTypes.bool,
5959
overwriteCustomMetadata: PropTypes.bool,
60-
customMetadata: PropTypes.any,
60+
customMetadata: PropTypes.oneOf([PropTypes.string, PropTypes.object]),
6161
onError: PropTypes.func,
6262
onSuccess: PropTypes.func,
6363
onUploadStart: PropTypes.func,
@@ -67,7 +67,7 @@ const Props = {
6767
transformation: PropTypes.object,
6868
}
6969

70-
export type IKUploadProps = InferProps<typeof Props> & {
70+
export type IKUploadProps = Omit<InferProps<typeof Props>, "customMetadata" | "transformation"> & {
7171
useUniqueFileName?: boolean;
7272
tags?: Array<string>;
7373
folder?: string;

0 commit comments

Comments
 (0)