microsoft / microsoft/TypeScript
Generated d.ts imports package that is not installed on current project
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔎 Search Terms
"d.ts unresolved modules import"
🕗 Version & Regression Information
Typescript v5.5.4
⏯ Playground Link
No response
💻 Code
Here is a basic reproduction: https://github.com/baptisteArno/zod-d-ts-issue
- pnpm install
- pnpm turbo build --filter=package-three...
- See error because schema is of type any
🙁 Actual behavior
package-two generates with imports from zod which package is not installed in package-two.
This means that the type that we get when importing things from package-two are of inferred type any
🙂 Expected behavior
I would expect the d.ts file to instead imports from installed packages only.
In that very specific case, I would expect it to generate:
export declare const schema: typeof import("package-one").schema
instead of
export declare const schema: import("zod").ZodObject<
{
id: import("zod").ZodString;
name: import("zod").ZodString;
},
"strip",
import("zod").ZodTypeAny,
{
id: string;
name: string;
},
{
id: string;
name: string;
}
>;
Additional information about the issue
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Reproduktion unter github.com/baptisteArno/zod-d-ts-issue, führe pnpm install und pnpm turbo build --filter=package-three... aus und untersuche die generierte Deklaration von package-two. Verfolge, wie der Compiler Importe für abgeleitete Deklarationstypen auswählt; abgeschlossen ist die Aufgabe, wenn die Deklaration das nicht verfügbare zod-Paket nicht mehr benötigt und die erwartete package-one-Referenz beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100