nmamali / expo-barcode-generator

A React Native barcode generator compatible with Expo
MIT License
5 stars 5 forks source link

Could not find a declaration file for module 'expo-barcode-generator' #6

Open argelj289 opened 9 months ago

argelj289 commented 9 months ago

Hi Team,

I'm getting issue when I am importing expo-barcode-generator package in my project.

I keep seeing this message in the import:

Could not find a declaration file for module 'expo-barcode-generator'. 'c:/.../node_modules/expo-barcode-generator/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/expo-barcode-generator if it exists or add a new declaration (.d.ts) file containing declare module 'expo-barcode-generator';

image

JPStrydom commented 9 months ago

@argelj289 We don't currently have TypeScript support, but we're happy to accept a PR if you'd like to add support for it.

illud commented 3 months ago

Hello @argelj289 do this,

  1. Create a Declaration File:

    Create a file named declarations.d.ts in a directory like @types (or in the root of your project if the @types directory is not present).

  2. Add the Following Content:

    In the declarations.d.ts file, add the following code:

    
    declare module 'expo-barcode-generator';
    
    ## For me i just created a declarations.d.ts file in my app folder and added the declare module 'expo-barcode-generator then i imported again in my view and it worked.