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

Missing ngtsc diagnostics for invalid inputs, outputs, queries and signal APIs

Đang mở
#508 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

Chưa có ai nhận issue này.

Đá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
52/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
angular, rust, typescript
Lĩnh vực
compilers

Hướng nghiên cứu

Start in crates/oxc_angular_compiler/src/directive/property_decorators.rs and directive/decorator.rs, then compare the corresponding ngtsc checks in shared.ts and input_output_parse_options.ts. Review initializer_api_usage_rule.ts for NG8110. Use the checklist snippets as repro cases; done means the expected diagnostics are emitted and the incorrect bindings, queries, and metadata are no longer produced.

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

Mô tả

bug

ngtsc 22.1.7 rejects each form below. OXC (main and #504 tip, 3e0b07f) compiles them with no diagnostic. Often the output is wrong too: a binding is dropped, duplicated, or a query is registered twice.

Each snippet uses import {Component, Directive, Input, Output, EventEmitter, ViewChild, ContentChild, input, output, viewChild, model} from '@angular/core';.

Checklist

ngtsc message is exact (codes shown as NGxxxx). The OXC column is #504 tip; main is the same.

  • Decorator on a signal query. @ViewChild('a') q = viewChild('a');
    ngtsc: NG1050: Using @ViewChild with a signal-based query is not allowed. (same for @ContentChild etc.)
    OXC: no error. Emits a decorator ɵɵviewQuery.
  • input() / model() not used directly as a field initializer. a = input(0)!;, m = model(0)!;, a = input(0) satisfies any;, constructor() { const x = input(0); }
    ngtsc: NG8110: Unsupported call to the input function. This function can only be called in the initializer of a class member. (model gives "...the model function...")
    OXC: no error. The input is silently left out of inputs.
  • Signal API on a private / #private member. private a = input(0); / #a = input(0);
    ngtsc: NG1053: Cannot use "input" on a class member that is declared as private. Update the class field to be either: public, public readonly, protected (... declared as ES private. ... for #a)
    OXC: no error. private compiles as a normal input. #a is silently dropped.
  • Signal option alias is not a string literal. a = input(0, {alias: 1 as any});, o = output({alias: 1 as any});, and input(0, {alias: ALIAS}) with ALIAS imported from another file
    ngtsc: NG1010: Alias needs to be a string that is statically analyzable.
    OXC: no error. The alias is ignored (inputs:{a:[1,"a"]}, outputs:{o:"o"}).
  • Two members bound to the same public name. @Input('y') x: any; @Input() y: any;
    ngtsc: NG1054: Input 'y' is bound to both 'x' and 'y'.
    Same for outputs: NG1054: Output 'y' is bound to both 'x' and 'y'.
    OXC: no error. Both are emitted (outputs:{x:"y",y:"y"}).
  • Two query decorators on one member. @ViewChild('a') @ContentChild('b') q: any;
    ngtsc: NG1006: Cannot combine multiple query decorators.
    OXC: no error. Emits both a contentQuery and a viewQuery writing to ctx.q.
  • @Input together with a query decorator. @Input() @ViewChild('a') q: any;
    ngtsc: NG1006: Cannot combine @Input decorators with query decorators
    OXC: no error. Emits both inputs:{q:"q"} and a viewQuery.
  • Static members.
    • @Input() static a: any; → NG1100: Input "a" is incorrectly declared as static member of "D".
    • @ViewChild('a') static q: any; → NG1100: Query is incorrectly declared on a static class member.
    • @Output() static o = new EventEmitter(); → NG1100: Output is incorrectly declared on a static class member.
      OXC: no error. All three are emitted as if they were instance members.
  • @Output() on a setter. @Output() set o(v: any) {}
    ngtsc compiles it: outputs: { o: "o" }. With a bad argument, @Output(1 as any) set o(v: any) {}, it reports NG1010: @Output decorator argument must resolve to a string Value is of type 'number'.
    OXC: drops the output (no outputs, {} in .d.ts) and does not check the argument.
  • Directive with selector: ''. @Directive({selector: ''}) export class D {}
    ngtsc: NG2004: Directive D has no selector, please add it!
    OXC: no error. Emits ɵɵdefineDirective({type:D}) and "" as the .d.ts selector. (Components with selector: '' are tracked separately.)

Where ngtsc raises them (Angular v22.0.0 source)

  • packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.ts: NG2004, NG1006 ×2, NG1054 ×2, NG1100 ×3, NG1050
  • .../annotations/directive/src/initializer_function_access.ts: NG1053
  • .../annotations/directive/src/input_output_parse_options.ts: alias NG1010
  • .../validation/src/rules/initializer_api_usage_rule.ts: NG8110 (a source-file check, not part of the decorator handler)

On the OXC side, most belong in crates/oxc_angular_compiler/src/directive/property_decorators.rs and directive/decorator.rs.

On main?

Yes, all of them. The stack doesn't change these cases.

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

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.