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 just-pipe #562

Open
terrygonguet opened this issue Jun 17, 2023 · 1 comment · May be fixed by #571
Open

Could not find a declaration file for module just-pipe #562

terrygonguet opened this issue Jun 17, 2023 · 1 comment · May be fixed by #571

Comments

@terrygonguet
Copy link

Hi, thanks, love the packages!

I'm using a pretty basic vite vanilla typescript setup and just-pipe@1.0.0 causes an interesting error:

error TS7016: Could not find a declaration file for module 'just-pipe'. 'C:/Users/.../node_modules/.pnpm/just-pipe@1.0.0/node_modules/just-pipe/index.mjs' implicitly has an 'any' type.
There are types at 'C:/Users/.../node_modules/just-pipe/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'just-pipe' library may need to update its package.json or typings.

The error goes away if I edit just-pipe's package.json to look like just-compose's:

  "exports": {
    ".": {
      "require": "./index.js",
      "default": "./index.mjs",
+     "types": "./index.d.ts"
    }
  },
Here's my tsconfig.json if it helps.
{
	"compilerOptions": {
		"target": "ES2020",
		"useDefineForClassFields": true,
		"module": "ESNext",
		"lib": ["ES2020", "DOM", "DOM.Iterable"],
		"skipLibCheck": true,

		/* Bundler mode */
		"moduleResolution": "node16",
		"allowImportingTsExtensions": true,
		"allowSyntheticDefaultImports": true,
		"resolveJsonModule": true,
		"isolatedModules": true,
		"declaration": true,
		"emitDeclarationOnly": true,
		"outDir": "./types",

		/* Linting */
		"strict": true,
		"noUnusedLocals": true,
		"noUnusedParameters": true
	},
	"include": ["src"]
}

I've always been quite confused about how to specify types in package.json but this one seems like a simple fix.

@uncenter
Copy link

Yeah you can see the issue on arethetypeswrong.github.io - looks like quite a few of these packages are published incorrectly. I'll try to make a PR at some point.

@TClark1011 TClark1011 linked a pull request Dec 8, 2023 that will close this issue
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.

2 participants