Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Constructor param typed `ns.Foo` (namespace-qualified) compiles to ɵɵinvalidFactoryDep

Đang mở
#633 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@edbzn đang làm issue này rồi.

Từ ngày 25/10/2026.

  • #634 của @edbzn — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, rust, typescript
Lĩnh vực
backend, compilers

Hướng nghiên cứu

Start with the ngtsc spec cases named in the issue and trace how extract_param_token handles constructor parameter types, comparing TSQualifiedName handling with the resolution used by setClassMetadata. The expected result is generated ɵɵinject calls for namespace-qualified types; verify both namespace and named imports against the reported cases. Pull request #634 is already open for this issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

A constructor parameter typed with a qualified name on an import (ns.Zero, ns.one.One) compiles to ɵɵinvalidFactoryDep, so instantiating the class throws at runtime. ngc treats the qualified name as a value reference, the same as a plain imported name. Applies to @Injectable, @Component, @Directive, @Pipe and @NgModule factories.

Found by running Angular's ngtsc spec ngtsc_spec.ts: "should generate correct imports for type references to namespaced symbols using a namespace import" (and "... using named imports") against oxc.

Reproduction

import {Injectable} from '@angular/core';
import * as ns from './ns'; // export class Zero {}; export namespace one { export class One {} }

@Injectable()
export class MyService {
  constructor(zero: ns.Zero, one: ns.one.One) {}
}
Actual
return new (__ngFactoryType__ || MyService)(i0.ɵɵinvalidFactoryDep(0), i0.ɵɵinvalidFactoryDep(1));
Expected (ngc)
import * as i1 from "./ns";
return new (__ngFactoryType__ || MyService)(i0.ɵɵinject(i1.Zero), i0.ɵɵinject(i1.one.One));

With a named import (import {ns} from './ns'), ngc emits i0.ɵɵinject(i1.ns.Zero).

Cause

The DI token extraction (extract_param_token) returns no token for a TSQualifiedName, while setClassMetadata already resolves the same type ({type: i1.one.One}).

Ngôn ngữ chính
Rust
Star
244
Fork
26
Merge trung bình
1 ngày 16 phút
Pull request đã merge (30 ngày)
87

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của voidzero-dev/oxc-angular-compiler

Tất cả issue của voidzero-dev/oxc-angular-compiler

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.