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

Could not find a declaration file for module 'cal-heatmap' #537

Open
askme23 opened this issue Jan 28, 2025 · 1 comment
Open

Could not find a declaration file for module 'cal-heatmap' #537

askme23 opened this issue Jan 28, 2025 · 1 comment

Comments

@askme23
Copy link

askme23 commented Jan 28, 2025

Hey, I am trying to integrate cal-heatmap with nextjs but have an error with importing library:

Could not find a declaration file for module 'cal-heatmap'. '/Users/ruslangorelov/projects/life-history/front/node_modules/.pnpm/[email protected]/node_modules/cal-heatmap/dist/cal-heatmap.js' implicitly has an 'any' type.
Try npm i --save-dev @types/cal-heatmap if it exists or add a new declaration (.d.ts) file containing declare module 'cal-heatmap';

My component:

import Image from "next/image";

import CalHeatmap from 'cal-heatmap';

function CalendarHeatMap() {
  const d = new CalHeatmap();
  d.paint({});
  
  return (
    <div id="cal-heatmap"></div>
  )
}

export default function Home() {
  return (
    <div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
      <CalendarHeatMap />
    </div>
  );
}

and tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2017",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "Node16",
    "moduleResolution": "node16",
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

I was trying to play with some options in tsconfig, but it wasn't successful. Help me find out what is the problem here )

@askme23
Copy link
Author

askme23 commented Jan 30, 2025

@wa0x6e can you help ?)

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

No branches or pull requests

1 participant