Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issue with NextJS - Could not find a declaration file for module 'react-data-table-component' #1198

Closed
5 tasks done
rajexp opened this issue Jan 12, 2024 · 4 comments · Fixed by #1199
Closed
5 tasks done
Assignees

Comments

@rajexp
Copy link

rajexp commented Jan 12, 2024

Issue Check list

  • Agree to the Code of Conduct
  • Read the README
  • You are using React 16.8.0+
  • You installed styled-components
  • Include relevant code or preferably a code sandbox

Describe the bug

Build Issues with next.js

Type error: Could not find a declaration file for module 'react-data-table-component'. 'D:/tathyaAPI/tathya/tathyaweb/node_modules/react-data-table-component/dist/index.cjs.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react-data-table-component` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-data-table-component';`

  3 | import { getCloudData, updateCloudData } from "@api/api";
  4 | import { TCloudData, TDateRange, TImage, TPlant } from "@types";
> 5 | import DataTable, { ExpanderComponentProps, TableColumn } from 'react-data-table-component';

Versions (please complete the following information)

  • Node 18.18.2
  • React ^18.2.0
  • Styled Components ^6.1.1
  • OS: Ubuntu

Additional context

package.json

{
    "name": "xxxx",
    "version": "0.2.3",
    "private": true,
    "homepage": "https://xxx.xxx",
    "dependencies": {
        "@ant-design/icons": "^5.2.6",
        "@date-io/date-fns": "1.3.13",
        "@unocss/postcss": "^0.57.3",
        "@unocss/preset-uno": "^0.57.3",
        "@unocss/reset": "^0.57.4",
        "antd": "^5.11.2",
        "axios": "^1.6.1",
        "chart.js": "^4.4.0",
        "date-fns": "^2.30.0",
        "next": "^14.0.1",
        "react": "^18.2.0",
        "react-bootstrap": "^1.3.0",
        "react-chartjs-2": "^5.2.0",
        "react-data-table-component": "^7.6.1",
        "react-dom": "^18.2.0",
        "react-ga": "^3.3.1",
        "react-ga4": "^2.1.0",
        "react-moment": "^1.1.3",
        "react-parallax": "^3.5.1",
        "react-redux": "^8.1.3",
        "react-scroll": "^1.9.0",
        "react-sticky": "^6.0.3",
        "react-tsparticles": "^2.12.2",
        "recoil": "^0.7.7",
        "redux": "^4.2.1",
        "redux-thunk": "^2.4.2",
        "scss": "^0.2.4",
        "slick-carousel": "^1.8.1",
        "style-loader": "^3.3.3",
        "styled-components": "^6.1.1",
        "swiper": "^11.0.3",
        "tiff": "^5.0.3",
        "tsparticles": "^2.12.0",
        "unocss": "^0.57.2",
        "xlsx": "^0.18.5"
    },
    "scripts": {
        "start": "next start",
        "dev": "next dev",
        "build": "next build",
        "test": "next test",
        "eject": "react-scripts eject",
        "predeploy": "npm run build",
        "deploy": "npm run build"
    },
    "browserslist": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            "last 1 chrome version",
            "last 1 firefox version",
            "last 1 safari version"
        ]
    },
    "devDependencies": {
        "@babel/preset-env": "^7.23.3",
        "@types/react": "^18.2.0",
        "@types/react-sticky": "^6.0.6",
        "eslint": "^8.54.0",
        "typescript": "^5.3.3"
    }
}

@HarikalarKutusu
Copy link

I confirm this issue. I had to revert back to v7.5.4 to make it build. v7.6.0 has the same problem.

@randydijkstra
Copy link

The reference to the types in the package.json is wrong.

It points to dist/src/index.d.ts rather than dist/index.d.ts were it is now.

@jbetancur jbetancur self-assigned this Jan 12, 2024
@jbetancur
Copy link
Owner

I can put a fix in for this today, unless someone wants to put up a PR for this sooner!

@jbetancur
Copy link
Owner

Fix is building - will cut a 7.6.2 shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants