Constructor param typed by a same-file interface is injected as a token (ReferenceError at runtime)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 73/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- angular, rust, typescript
- Área
- compilers
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 244
- Forks
- 26
- Merge medio
- 23 h 41 min
- PR fusionados (30 d)
- 106
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de voidzero-dev/oxc-angular-compiler
-
Partial mode: NgModule-declared components get no dependencies, so their directives never matchAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
voidzero-dev/oxc-angular-compiler#655 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
voidzero-dev/oxc-angular-compiler#654 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
voidzero-dev/oxc-angular-compiler#623 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Support useDefineForClassFields: false (Class Field Lowering)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 comentarios ·
Los mantenedores suelen responder en 1 día
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR runtime parity regressions (RouterLinkActive, Forms DI, Apollo DI) require app-level shimsQuizá libre de nuevo @Brooooooklyn la tomó hace 240 días y no hay ningún pull request abierto. Abierto
voidzero-dev/oxc-angular-compiler#61 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de voidzero-dev/oxc-angular-compiler
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
compiler P4 perf
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
HerringtonDarkholme/hd-lang#1044 ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted r-docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
servo/rust-smallvec#824 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
akitaonrails/ai-usagebar#552 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100