react-native-compass-heading icon indicating copy to clipboard operation
react-native-compass-heading copied to clipboard

Types are missing in 1.5.0

Open jeanremy opened this issue 1 year ago • 2 comments

Hi,

Using the 1.5.0 version of the package, my editor can't find the type declaration file. According to the package.json, it should be at the root of the project, but no file is here. Instead, a declaration file is created inside the lib/typescript directory (with just any as type).

I'd be glad to help if you can give me some information about the build system.

Version 1.4.2 is fine, by the way (see it in npm)

jeanremy avatar Jul 21 '23 14:07 jeanremy

Yep, I also received this error, which prevents me from building the app, which is quite annoying:

Could not find a declaration file for module 'react-native-compass-heading'. '.../node_modules/react-native-compass-heading/lib/commonjs/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react-native-compass-heading` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-native-compass-heading';`ts(7016)

dnlgrgly avatar Aug 11 '23 11:08 dnlgrgly

I am also facing the same issue. As a temporary I patched the package. Using patch-pacakge

patches/react-native-compass-heading+1.5.0.patch

diff --git a/node_modules/react-native-compass-heading/package.json b/node_modules/react-native-compass-heading/package.json
index 1093f71..20e8947 100644
--- a/node_modules/react-native-compass-heading/package.json
+++ b/node_modules/react-native-compass-heading/package.json
@@ -4,7 +4,7 @@
   "description": "Listener to device's compass information.",
   "main": "lib/commonjs/index",
   "module": "lib/module/index",
-  "types": "index.d.ts",
+  "types": "lib/typescript/index.d.ts",
   "react-native": "src/index",
   "source": "src/index",
   "files": [

In order to create a patch run either copy the file or run this npx patch-package react-native-compass-heading --exclude 'nothing'

pranshuchittora avatar Nov 02 '23 12:11 pranshuchittora