Constructor param typed by a same-file interface is injected as a token (ReferenceError at runtime)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 73/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, rust, typescript
- Domínio
- compilers
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Rust
- Estrelas
- 244
- Forks
- 26
- Merge médio
- 23h 41min
- PRs com merge (30d)
- 106
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/oxc-angular-compiler
-
Partial mode: NgModule-declared components get no dependencies, so their directives never matchAberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
voidzero-dev/oxc-angular-compiler#655 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
voidzero-dev/oxc-angular-compiler#654 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 28/100
voidzero-dev/oxc-angular-compiler#623 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Support useDefineForClassFields: false (Class Field Lowering)Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 comentários ·
Mantenedores costumam responder em até 1 dia
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR runtime parity regressions (RouterLinkActive, Forms DI, Apollo DI) require app-level shimsTalvez livre de novo @Brooooooklyn assumiu há 240 dias e não há nenhum pull request aberto. Aberta
voidzero-dev/oxc-angular-compiler#61 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/oxc-angular-compiler
Issues semelhantes
-
spurctld: a user with no usage gets a lower fair-share factor than a user with a little usageAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
area:ci kind:bug priority:p3 ready
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
tech-debt
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
srikanth235/centraid#1155 ·
Mantenedores costumam responder em até 1 dia
-
dotfiles: failed batch untrack removes earlier tracking declarationsTalvez já em andamento @jdx assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 2 dias