dts: `typeof X` references in ɵmod / hostDirectives use local names with no import (TS2304 in published .d.ts)

Aperta
#692 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, typescript

Direzione di ricerca

Start in dts.rs at the formatter locations listed in the issue: lines 392, 406, 420, 720, and 769. Trace how declarations are generated for ɵmod members and hostDirectives, then check the bundled and unbundled examples against the emitted .d.ts files. Done means referenced classes, including aliased host directives, resolve for consumers without skipLibCheck; add or run focused declaration emit tests for those cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Found while reviewing #683. The member text comes from the compiler (dts.rs), so both the asset and chunk paths ship it.

ngtsc writes references to other classes in .d.ts members as typeof i1.X with import * as i1 from "./x". Oxc writes the local name with no import: format!("typeof {}", …) at dts.rs:392/406/420 (ɵmod declarations / imports / exports) and dts.rs:720/769 (hostDirectives). The name only resolves if that class happens to be declared in the same .d.ts under the same name. Declaration emit drops imports only used by decorators, so it often isn't.

A. bundled (rolldown-plugin-dts), index.ts exports only LibModule
   static ɵmod: i0.ɵɵNgModuleDeclaration<LibModule, never, [typeof InternalComponent], [typeof InternalComponent]>;
   → InternalComponent is not declared in index.d.ts → consumer tsc: TS2304 Cannot find name 'InternalComponent'

B. tsdown unbundle: true
   lib.module.d.mts: [typeof HelloComponent, typeof HighlightDirective], no import of either → 4× TS2304

C. aliased host directive: import { HighlightDirective as HD } …; hostDirectives: [{ directive: HD }]
   [{ directive: typeof HD; … }]  → no `HD` in the emitted .d.ts → TS2304 (or `any` with skipLibCheck)

With skipLibCheck: true the errors go away, but the types become any, so the consumer's Angular compiler can't see the module's exported components.

Lingua principale
Rust
Stelle
245
Fork
26
Merge medio
1g 42m
PR unite (30g)
83

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di voidzero-dev/oxc-angular-compiler

Tutte le issue di voidzero-dev/oxc-angular-compiler

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.