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

TypeScript Could not find the declaration files #693

Open
itz-saran opened this issue Feb 5, 2025 · 1 comment
Open

TypeScript Could not find the declaration files #693

itz-saran opened this issue Feb 5, 2025 · 1 comment

Comments

@itz-saran
Copy link

sveltekit version - "^2.16.0"
svelte version - "^5.0.0"
mdsvex version - "^0.12.3"

When using the newest version, the typescript complains about declaration files:

import { mdsvex } from 'mdsvex' // error here

And the error message is

Could not find a declaration file for module 'mdsvex'. '/home/saran/kernel-panic/node_modules/.pnpm/[email protected][email protected]/node_modules/mdsvex/dist/main.mjs' implicitly has an 'any' type.
  There are types at '/home/saran/kernel-panic/node_modules/mdsvex/dist/main.cjs.d.ts', but this result could not be resolved when respecting package.json "exports". The 'mdsvex' library may need to update its package.json or typings.ts(7016)

This looks similar to issue #648 , But when I checked the exports in package.json of mdsvex it is different compared to the fix given in PR #651. Looks like type are missing

"exports": {
    ".": {
      "require": "./dist/main.cjs",
      "default": "./dist/main.mjs"
    },
    "./package.json": "./package.json"
  },
  "main": "dist/main.cjs",
  "module": "dist/main.mjs",
  "repository": "https://github.com/pngwn/MDsveX",
  "files": [
    "dist/*",
    "globals.d.ts"
  ],

Also my tsconfig for reference

{
	"extends": "./.svelte-kit/tsconfig.json",
	"compilerOptions": {
		"allowJs": true,
		"checkJs": true,
		"esModuleInterop": true,
		"forceConsistentCasingInFileNames": true,
		"resolveJsonModule": true,
		"skipLibCheck": true,
		"sourceMap": true,
		"strict": true,
		"moduleResolution": "bundler"
	}
}
@github-project-automation github-project-automation bot moved this to Triage + Refine in mdsvex Feb 5, 2025
@danielwerg
Copy link

No new releases have been made since #651 PR. Duplicate of #648.

[email protected]#diff-a50c8922417615fa3db80c81ecbf74b1fe5927c7eca732ee2edeb3782ac95686

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

No branches or pull requests

2 participants