BlinkID / blinkid-react-native

ID scanning for cross-platform apps built with ReactNative.
175 stars 59 forks source link

How to import typescript declaration for this module #172

Open stardustdev opened 3 years ago

stardustdev commented 3 years ago

I'd like to use this module in react native typescript project. But I can't find declaration file for this module. How can I use this in typescript?

mparadina commented 3 years ago

Hi @stardustdev

Apologies for the delay in our response.

After you've initialized our script for React-Native, you can try to add the following: npm install -D typescript @types/jest @types/react @types/react-native @types/react-test-renderer

You can also change the files from .js to .ts, and the project should run properly.

Let me know if this helped.

Regards, Milan

stardustdev commented 3 years ago

This cli is for adding typescript to js RN project npm install -D typescript @types/jest @types/react @types/react-native @types/react-test-renderer

But my question is how to use BlinkID/blinkid-react-native in .tsx?

juraskrlec commented 3 years ago

Hi @stardustdev

We do not have typings for our react-native plugin. You have two options for now:

  1. You could write the typing information for blinkid-react-native by yourself and save it into blinkid-react-native.d.ts file.
  2. Disable the warning inside your tsconfig.json by setting "noImplicitAny": false - Reference : https://www.typescriptlang.org/docs/handbook/compiler-options.html

Do you have any sample app so we could have a look, and what did you try to use our plugin with typescript project?

AbijahKaj commented 1 year ago

Hey @stardustdev ! I had the same issue, and made this gist https://gist.github.com/AbijahKaj/42d848cb9a9cdb6fb0804baf82da7f3d it has all the types (I hope so).