mobile-messaging-react-native-plugin icon indicating copy to clipboard operation
mobile-messaging-react-native-plugin copied to clipboard

Fix typescript types in index.d.ts

Open ShpetimA opened this issue 5 months ago • 1 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

When i am running typecheck in my react native application this file is throwing an error . Found 18 errors in the same file, starting at: node_modules/infobip-mobile-messaging-react-native-plugin/src/index.d.ts:676

I managed to solve this issue by adding function to the names of the namespace functions in WebRTCUI

Here is the diff that solved my problem:

diff --git a/node_modules/infobip-mobile-messaging-react-native-plugin/src/index.d.ts b/node_modules/infobip-mobile-messaging-react-native-plugin/src/index.d.ts
index 9c3f496..ca55bd7 100644
--- a/node_modules/infobip-mobile-messaging-react-native-plugin/src/index.d.ts
+++ b/node_modules/infobip-mobile-messaging-react-native-plugin/src/index.d.ts
@@ -673,7 +673,7 @@ declare namespace WebRTCUI {
      * @param {Function} onSuccess success callback
      * @param {Function} onError error callback
      */
-    enableCalls(identity:string, onSuccess:() => void, onError:(error: MobileMessagingError) => void):void;
+    function enableCalls(identity:string, onSuccess:() => void, onError:(error: MobileMessagingError) => void):void;
 
     /**
      * Manually enable WebRTCUI LiveChat calls.
@@ -681,7 +681,7 @@ declare namespace WebRTCUI {
      * @param {Function} onSuccess success callback
      * @param {Function} onError error callback
      */
-    enableChatCalls(onSuccess:() => void, onError:(error: MobileMessagingError) => void):void;
+    function enableChatCalls(onSuccess:() => void, onError:(error: MobileMessagingError) => void):void;
 
     /**
      * Manually disable WebRTCUI calls if they were previously enabled. Note: This action may need up to half a minute to be completed,
@@ -690,5 +690,5 @@ declare namespace WebRTCUI {
      * @param {Function} onSuccess success callback
      * @param {Function} onError error callback
      */
-    disableCalls(onSuccess:() => void, onError:(error: MobileMessagingError) => void):void;
+    function disableCalls(onSuccess:() => void, onError:(error: MobileMessagingError) => void):void;
 }
\ No newline at end of file

This issue body was partially generated by patch-package.

ShpetimA avatar Sep 23 '24 14:09 ShpetimA