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

setClassMetadata ctorParams emits a type for type-only annotations — should be undefined

Đã đóng
#563 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

Một pull request liên quan đã được merge.

  • #564 của @Brooooooklyn — đã merge

Đánh giá

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

Hướng nghiên cứu

Start in ngtsc/annotations/common/src/metadata.ts, especially ctorParameterToMetadata, and compare how it handles unavailable type-value references with OXC’s setClassMetadata output. Run the named class-metadata and full-file fixtures and their comparison tests. Done means type-only annotations emit type: undefined, while value-space symbols still emit their type, and the listed fixtures no longer differ.

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

Mô tả

Found via #561 (live setClassMetadata comparison in e2e/compare).

For a constructor param whose type annotation is type-only — an interface, type alias, or type parameter — ngtsc emits type: undefined in setClassMetadata ctorParams (ctorParameterToMetadata in ngtsc/annotations/common/src/metadata.ts emits LiteralExpr(undefined) when param.typeValueReference.kind === TypeValueReferenceKind.UNAVAILABLE).

OXC emits the annotation's name regardless:

import { Injectable, Inject, InjectionToken } from '@angular/core';
interface ApiConfig { baseUrl: string }
export const API_CONFIG = new InjectionToken<ApiConfig>('apiConfig');
@Injectable({ providedIn: 'root' })
export class TestableService {
  constructor(@Inject(API_CONFIG) private apiConfig: ApiConfig) {}
}

OXC emits ctorParams: () => [{ type: ApiConfig, decorators: [...] }] — ApiConfig is an interface, erased at compile time, so evaluating the thunk throws ReferenceError. ngtsc emits type: undefined.

Fix: the ctorParams metadata builder should only emit type: when the annotation names a value-space symbol (class, enum, imported value binding); otherwise undefined. Fixtures currently surfacing this: class-metadata/class-metadata-injectable, class-metadata/class-metadata-with-inject, full-file/component-with-services (declared as known differences until this is fixed).

Ngôn ngữ chính
Rust
Star
232
Fork
21
Merge trung bình
1 ngày 16 giờ
Pull request đã merge (30 ngày)
62

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.