Doko-Demo-Doa / react-native-shake

React Native shake event detector
MIT License
260 stars 63 forks source link

Typescript support in beta #67

Open samducker opened 1 week ago

samducker commented 1 week ago

Hi I have migrated to the beta as I could not get the previous versions to work at all in Expo SDK 52.

However I get this typescript error with the latest.

Could not find a declaration file for module 'react-native-shake'. '/Users/sam/project/node_modules/react-native-shake/lib/commonjs/index.js' implicitly has an 'any' type.
  There are types at ''/Users/sam/project/node_modules/react-native-shake/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'.ts(7016)
Doko-Demo-Doa commented 1 week ago

Hi @samducker as you can see in the suggestion, you may need to change moduleResolution field to Bundler. E.g:

{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "strict": true,
    "moduleResolution": "Bundler", // <-- this one
    "baseUrl": ".",
    "paths": {
      "~/*": ["src/*"],
      "@assets/*": ["assets/*"]
    }
  },
  "include": ["**/*.ts", "**/*.tsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
}