zoho/react-native-zohodesk-portal-sdk

Declaration file for module 'react-native-zohodesk-portal-sdk'

jon-moreira opened this issue · 1 comments

Could not find a declaration file for module 'react-native-zohodesk-portal-sdk'. '/{app-path}/node_modules/react-native-zohodesk-portal-sdk/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react-native-zohodesk-portal-sdk` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-native-zohodesk-portal-sdk';`

And if I try to install the package ...

@types/react-native-zohodesk-portal-sdk@unknown can't be resolved to a satisfying range
The remote server failed to provide the requested resource
Response Code: 404 (Not Found)
Request Method: GET
Request URL: https://registry.yarnpkg.com/@types%2freact-native-zohodesk-portal-sdk

You just need to create a definition file (*.d.ts) with the following content (or update the existing one) and make sure that it's included in your project:

declare module "react-native-zohodesk-portal-sdk"

To have better TS support you can also extend it with proper objects and functions that you can get from library files

declare module "react-native-zohodesk-portal-sdk" {
  const ZohoDeskPortalSDK = {
    initialise: (orgId: string, appId: string, dc: string) => {
      //
    },
  }
  const ZDPortalHome = {
    show: () => {
      //
    },
  }
  export { ZohoDeskPortalSDK, ZDPortalHome }
}