Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jon-moreira opened this issue Oct 21, 2022 · 1 comment
Open

Comments

@jon-moreira
Copy link

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
@mkurczewski
Copy link

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 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants