Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Constructor param typed by a same-file interface is injected as a token (ReferenceError at runtime)

Abierto
#653 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de voidzero-dev/oxc-angular-compiler

Todos los issues de voidzero-dev/oxc-angular-compiler

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.