georstat/react-native-image-cache

Fix CachedImage onError typescript declaration

Closed this issue · 2 comments

skam22 commented

onError prop has incorrect typescript declaration, causes an error to be shown in IDE:

Screenshot 2023-03-17 at 11 55 30 AM

Here is the diff that solved my problem:

diff --git a/node_modules/@georstat/react-native-image-cache/lib/typescript/CachedImage.d.ts b/node_modules/@georstat/react-native-image-cache/lib/typescript/CachedImage.d.ts
index 3a5f97b..dffa141 100644
--- a/node_modules/@georstat/react-native-image-cache/lib/typescript/CachedImage.d.ts
+++ b/node_modules/@georstat/react-native-image-cache/lib/typescript/CachedImage.d.ts
@@ -4,7 +4,7 @@ declare const defaultProps: {
     onError: () => void;
 };
 declare const CachedImage: {
-    (props: IProps & typeof defaultProps): JSX.Element;
+    (props: IProps | typeof defaultProps): JSX.Element;
     defaultProps: {
         onError: () => void;
     };

This issue body was partially generated by patch-package.

Hi @skam22 , can you please create a PR for this? Thanks

ps. sorry for the late reply

skam22 commented

opened PR #51