Constructor param typed by a same-file interface is injected as a token (ReferenceError at runtime)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 73/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- angular, rust, typescript
- Bereich
- compilers
Rechercherichtung
Start by reading extract_param_token in component/decorator.rs and injectable/decorator.rs, then inspect the copies in the directive, pipe, and ng_module decorators. Compare how those paths handle type-only imports and check the compiler tests for dependency token extraction. Done means same-file interface and type alias parameters produce invalid dependencies and the reported runtime and strict injection behavior is covered.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
A constructor parameter typed by an interface or type alias that is declared in the same file is compiled as an injection token. The interface is erased, so creating the class throws ReferenceError: Foo is not defined. ngtsc treats the parameter as having no token.
Found while re-checking #623.
Reproduction
import {Injectable} from '@angular/core';
interface Foo { a: number }
@Injectable()
export class S {
constructor(f: Foo) {}
}
| ngtsc 22.2.3 | oxc (main 5780233) | |
|---|---|---|
| full | i0.ɵɵinvalidFactory() |
new (t || S)(i0.ɵɵinject(Foo)) |
| partial | deps: "invalid" |
deps: [{ token: Foo }] |
strictInjectionParameters |
NG2003 error | no error |
Cause
extract_param_token (component/decorator.rs, injectable/decorator.rs, and the copies in the directive, pipe and ng_module decorators) takes the name of any TSTypeReference and never checks whether that name is a type-only declaration in the file.
A fix can mark the dep invalid when the name is an interface or type declared in the same file, as is already done for type-only imports. An interface imported through a value import from another file can't be detected one file at a time.
- Vorherrschende Sprache
- Rust
- Sterne
- 244
- Forks
- 26
- Ø Merge
- 23 Std. 41 Min.
- Gemergte PRs (30 T.)
- 106
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
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/oxc-angular-compiler
-
Partial mode: NgModule-declared components get no dependencies, so their directives never matchEvtl. vergeben @Brooooooklyn hat das heute übernommen. Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
voidzero-dev/oxc-angular-compiler#655 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
voidzero-dev/oxc-angular-compiler#654 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 28/100
voidzero-dev/oxc-angular-compiler#623 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Support useDefineForClassFields: false (Class Field Lowering)Evtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR runtime parity regressions (RouterLinkActive, Forms DI, Apollo DI) require app-level shimsEvtl. wieder frei @Brooooooklyn hat das vor 240 Tagen übernommen, und es ist kein Pull Request offen. Offen
voidzero-dev/oxc-angular-compiler#61 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/oxc-angular-compiler
Ähnliche Issues
-
good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
servo/rust-smallvec#827 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
nowledge-co/hawdb#1400 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
calcit-lang/caps#16 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
penso/herdr-gpui#934 ·
Maintainer antworten meist innerhalb von 1 Tag
-
🎉 Add BossanovaOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
jaywcjlove/awesome-mac#4096 ·
Maintainer antworten meist innerhalb von 1 Tag