NgModule: forwardRef(ns.X), ns.X.forRoot() and spread/const lists are not resolved (`.d.ts` gets `never`)

Offen
#703 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust
Bereich
compilers

Rechercherichtung

Start by reading the ModuleLists implementation and the evaluator used for .d.ts references in #697; the issue does not name source files or tests. Trace how NgModule imports and exports are evaluated, then check that forward references, forRoot() calls, and spread or const lists resolve in declarations and JIT scopes. Done means those cases match the ngtsc behavior shown in the issue.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Found while reviewing #697. Checked against ngtsc 22.2.4. ngtsc resolves NgModule lists statically. Oxc keeps the raw text, so the .d.ts gets never. Consumers then can't see what the module exports, and JIT scopes keep the call expressions.

import * as dep from './dep';
@NgModule({ imports: [forwardRef(() => dep.DepModule), dep.DepModule.forRoot()] }) export class M {}
           ngtsc                                                         Oxc
.d.ts      ɵɵNgModuleDeclaration<M, never, [typeof i1.DepModule,         ɵɵNgModuleDeclaration<M, never, never, never>
             typeof i1.DepModule], never>
scope      setNgModuleScope(M, { imports: [i1.DepModule, i1.DepModule] }) setNgModuleScope(M, { imports: [forwardRef(() => dep.DepModule), dep.DepModule.forRoot()] })
import { DepModule } from './dep';
const LIST = [DepModule];
@NgModule({ imports: [...LIST], exports: LIST }) export class M {}
           ngtsc                                                         Oxc
.d.ts      ɵɵNgModuleDeclaration<M, never, [typeof i1.DepModule],        ɵɵNgModuleDeclaration<M, never, never, never>
             [typeof i1.DepModule]>
scope      setNgModuleScope(M, { imports: [DepModule], exports: [DepModule] })  setNgModuleScope(M, { imports: [...LIST], exports: LIST })
ɵinj       imports: [LIST, DepModule]                                     imports: [...LIST, LIST]   (same at runtime)

To do: resolve forwardRef(() => ns.X), ns.X.forRoot() (ModuleWithProviders) and spread / const lists in ModuleLists, with the evaluator that #697's .d.ts references use.

Vorherrschende Sprache
Rust
Sterne
245
Forks
26
Ø Merge
1 T. 23 Min.
Gemergte PRs (30 T.)
83

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus voidzero-dev/oxc-angular-compiler

Alle Issues in voidzero-dev/oxc-angular-compiler

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

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