Type declarations break under moduleResolution: node16/nodenext (extensionless relative imports in ESM .d.ts files)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- build-system, developer-experience
Direzione di ricerca
Start by reproducing the TypeScript 5.x or 6.0.3 example with node16 or nodenext resolution and --traceResolution. Inspect dist/lib/pdfium/index.d.ts and the other published declaration files in @embedpdf/engines and @embedpdf/models. Done means the declaration re-exports resolve under ESM rules and the named imports compile without TS2305 or TS2834.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
@embedpdf/engines and @embedpdf/models (2.15.0) are unusable at the type level in projects using TypeScript's node16/nodenext module resolution. Every named import fails with TS2305 ("has no exported member") even though the API exists and works at runtime.
The published .d.ts tree uses extensionless relative specifiers (export * from './engine') inside packages declared "type": "module". Under node16/nodenext, TypeScript applies ESM resolution rules to those declaration files and requires explicit .js extensions, so every relative re-export fails to resolve and the entry-point modules end up with no members. The runtime JS is bundled into chunks with resolvable specifiers, which is why this only bites the type checker.
Reproduction
// package.json
{ "type": "module", "dependencies": { "@embedpdf/engines": "2.15.0" } }
// tsconfig.json
{ "compilerOptions": { "module": "nodenext", "moduleResolution": "nodenext", "noEmit": true } }
// index.ts
import { PdfEngine, PdfiumNative } from '@embedpdf/engines/pdfium';
import { createNodeImageDataToBufferConverter } from '@embedpdf/engines/converters';
error TS2305: Module '"@embedpdf/engines/pdfium"' has no exported member 'PdfEngine'.
error TS2305: Module '"@embedpdf/engines/pdfium"' has no exported member 'PdfiumNative'.
error TS2305: Module '"@embedpdf/engines/converters"' has no exported member 'createNodeImageDataToBufferConverter'.
Running with --traceResolution shows the underlying failures inside the package's own declaration files, e.g. resolving dist/lib/pdfium/index.d.ts:
error TS2834: Relative import paths need explicit file extensions in ECMAScript imports
when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
...
======== Module name './engine' was not resolved. ========
Reproduced with TypeScript 5.x and 6.0.3.
Root cause
dist/lib/pdfium/index.d.ts (and most of the declaration tree) re-exports without extensions:
export * from './engine';
export * from './helper';
export * from '../converters/types';
export * from '../converters/browser';
Since the package is "type": "module", these .d.ts files are interpreted as ESM, where node16/nodenext requires ./engine.js. In @embedpdf/engines 2.15.0 this affects 45 of the 69 published .d.ts files; @embedpdf/models 2.15.0 has the same problem (10 of 21 files). @embedpdf/pdfium is fine, since its index.d.ts is a single rolled-up file.
- Lingua principale
- TypeScript
- Stelle
- 4.5k
- Fork
- 317
- Merge medio
- 10h 16m
- PR unite (30g)
- 174
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di embedpdf/embed-pdf-viewer
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
embedpdf/embed-pdf-viewer#1098 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
embedpdf/embed-pdf-viewer#921 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
embedpdf/embed-pdf-viewer#889 ·
I maintainer di solito rispondono entro 1 giorno
-
[v2] TaskQueue: equal-priority tasks can run out of order when a randomUUID id starts with digitsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
embedpdf/embed-pdf-viewer#874 ·
I maintainer di solito rispondono entro 1 giorno
-
Free text stays scrolled to the caret after editing endsForse già presa @chahore l’ha presa 36 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
embedpdf/embed-pdf-viewer#861 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di embedpdf/embed-pdf-viewer
Issue simili
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
lingdojo/kana-dojo#34223 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
mastra-ai/mastra#30587 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:web p2 product:business triage:active type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cuadrao-ai/argus#2228 ·
I maintainer di solito rispondono entro 1 giorno
-
.Needs Triage .Team/Metabot Priority:P3 Type:Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
metabase/metabase#87252 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
NuGet registry builds every URL from ROOT_URL, ignoring the host the client usedForse già presa @gritse l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno