mkuczera / react-native-haptic-feedback

React-Native Haptic Feedback for iOS with Android similar behaviour.
MIT License
871 stars 106 forks source link

Could not find a declaration file for module 'react-native-haptic-feedback' #131

Closed ethanneff closed 1 month ago

ethanneff commented 2 months ago

version change

  ◉ react-native-haptic-feedback                 2.2.0  →    2.3.1

error

src/packages/Haptic/Haptic.ts:1:42 - error TS7016: Could not find a declaration file for module 'react-native-haptic-feedback'. '/Users/e/Documents/a/b/node_modules/react-native-haptic-feedback/lib/commonjs/index.js' implicitly has an 'any' type.
  There are types at '/Users/e/Documents/a/b/node_modules/react-native-haptic-feedback/lib/typescript/module/src/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

1 import { trigger as hapticTrigger } from 'react-native-haptic-feedback';
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 1 error in src/packages/Haptic/Haptic.ts:1

code

import { trigger as hapticTrigger } from 'react-native-haptic-feedback';

export const Haptic = {
  trigger: () => {
    hapticTrigger('impactLight', {
      enableVibrateFallback: true,
      ignoreAndroidSystemSettings: false,
    });
  },
};
gfirmill commented 2 months ago

I'm encountering the same thing when I upgraded to 2.3.1

chaosuperDK commented 2 months ago

Set your ts-config.ts compilerOptions moduleResolution and module to "NodeNext" Guess the reason is 2.3.1 package.json claims "exports" property

mayfairr-plt commented 2 months ago

Also getting this :/

mkuczera commented 1 month ago

Released as v2.3.2 . Sorry, didn´t have time before