+
Skip to content

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

Open
@terrygonguet

Description

@terrygonguet

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载