PepperDash / mobile-control-react-app-core

Base React app for Mobile Control
0 stars 0 forks source link

Could not find a declaration file for module '@pepperdash/mobile-control-react-app-core' #28

Closed ngenovese11 closed 3 weeks ago

ngenovese11 commented 3 weeks ago

When using the following code:

import { MobileControlProvider } from "@pepperdash/mobile-control-react-app-core";

I get the following error:

[{
    "message": "Could not find a declaration file for module '@pepperdash/mobile-control-react-app-core'. 'node_modules/@pepperdash/mobile-control-react-app-core/dist/mobile-control-react-app-core.es.js' implicitly has an 'any' type.\n  There are types at 'node_modules/@pepperdash/mobile-control-react-app-core/dist/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The '@pepperdash/mobile-control-react-app-core' library may need to update its package.json or typings.",
    "source": "ts",
}]

I was able to fix by manually manipulating the package.json file to the following:

"exports": {
    ".": {
      **"types": "./dist/index.d.ts",**
      "import": "./dist/mobile-control-react-app-core.es.js",
      "require": "./dist/mobile-control-react-app-core.umd.js"
    },
    "./dist/style.css": "./dist/style.css"
  },

but am not sure if this is correct or best practice. I just looked at other packages and matched what they had.

If that's acceptable, I'm happy to open a PR.

ndorin commented 3 weeks ago

@ngenovese11 where are you seeing that error? I haven't come across that one myself.

Are you seeing that in your browser console or in terminal in VS Code when compiling an app that references the library?

ngenovese11 commented 3 weeks ago

its in VS Code... doing some more testing

ngenovese11 commented 3 weeks ago

closing... its a config issue on my end