angus-c / angus-c/just

Could not find a declaration file for module `just-pipe`

Offen
#562 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
6.2k
Forks
209
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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:

```diff
"exports": {
".": {
"require": "./index.js",
"default": "./index.mjs",
+ "types": "./index.d.ts"
}
},
```

Here's my tsconfig.json if it helps.

```json5
{
"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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.