achievements-app / psn-api

A JavaScript library that lets you get trophy, user, and game data from the PlayStation Network.
https://psn-api.achievements.app
MIT License
263 stars 31 forks source link

Request to add "types" to package.json "exports" to fix "Not declaration file" related error messages #145

Closed Dylanmehl closed 10 months ago

Dylanmehl commented 1 year ago

When importing functions and types I get the following warning message on my imports.

Could not find a declaration file for module 'psn-api'. '/node_modules/psn-api/dist/psn-api.esm.js' implicitly has an 'any' type.   There are types at '/node_modules/psn-api/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'psn-api' library may need to update its package.json or typings.

You can easily fix this by adding "types": "./dist/index.d.ts" to the exports entry in package.json.

Thanks.

Hartaithan commented 10 months ago

@wescopeland any workaround for this? before fix getting shipped?

Hartaithan commented 10 months ago

ok, if you encounter this problem. Workaround for solving this issue is modifying your tsconfig.json

extend your tsconfig.json with this

"compilerOptions": { "moduleResolution": "node" },

wescopeland commented 10 months ago

Happy to accept a PR on this, I'm not sure how to verify whether or not this is working.