rapideditor / country-coder

📍➡️ 🇩🇰 Convert longitude-latitude pairs to ISO 3166-1 codes quickly and locally
https://ideditor.codes
ISC License
220 stars 17 forks source link

Types not added in package.json exports #133

Closed iraticasi closed 9 months ago

iraticasi commented 9 months ago

Package.json exports does not specify types, so declaration are not found when exports supported (moduleResolution: bundler in tsconfig) It should be specified in package.json as:

  "type": "module",
  "source": "./src/country-coder.ts",
  "types": "./dist/country-coder.d.ts",
  "main": "./dist/country-coder.cjs",
  "module": "./dist/country-coder.mjs",
  "exports": {
+    "types": "./dist/country-coder.d.ts",
    "import": "./dist/country-coder.mjs",
    "require": "./dist/country-coder.cjs"
  },

Error

TS7016: Could not find a declaration file for module '@rapideditor/country-coder'. 'my-project/node_modules/@rapideditor/country-coder/dist/country-coder.mjs' implicitly has an 'any' type.   There are types at 'my-project/node_modules/@rapideditor/country-coder/dist/country-coder.d.ts', but this result could not be resolved when respecting package.json "exports". The '@rapideditor/country-coder' library may need to update its package.json or typings.

bhousel commented 9 months ago

Sorry about that! I will push out a new version that includes this in the export map.