react-pagination icon indicating copy to clipboard operation
react-pagination copied to clipboard

Typescript types

Open vstepanyuk opened this issue 1 year ago • 1 comments

Could not find a declaration file for module '@lucasmogari/react-pagination'. 'node_modules/@lucasmogari/react-pagination/dist/react-pagination.es.js' implicitly has an 'any' type.

There are types at 'node_modules/@lucasmogari/react-pagination/dist/src/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@lucasmogari/react-pagination' library may need to update its package.json or typings.ts

vstepanyuk avatar Dec 20 '23 23:12 vstepanyuk

We had the same problem. It occurs when tsconfig.json in our project has moduleResolution: "Bundler". It works okay when tsconfig.json has moduleResolution: "node".

@lucasmogari, I believe it can be fixed in react-pagination package.json.

Current code (that gives the problem):

  // node_modules\@lucasmogari\react-pagination\package.json
  "exports": {
    ".": {
      "import": "./dist/react-pagination.es.js",
      "require": "./dist/react-pagination.umd.js"
    }
  },

Modified code (that works):

  // node_modules\@lucasmogari\react-pagination\package.json
  "exports": {
    ".": {
      "import": "./dist/react-pagination.es.js",
      "require": "./dist/react-pagination.umd.js",
      "types": "./dist/src/index.d.ts"
    }
  },

NillDk avatar Feb 29 '24 15:02 NillDk