Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

fix(emit): arrow functions in metadata lose default parameter values and `async`

Chiusa
#512 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Brooooooklyn ci sta già lavorando.

Dal 7/10/2026.

  • #555 di @Brooooooklyn — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, typescript
Ambito
compilers

Direzione di ricerca

Start in crates/oxc_angular_compiler/src/output/oxc_converter.rs, especially convert_arrow_function_expression, and inspect ArrowFunctionExpr in output/ast.rs; the issue notes that the function-expression path may have the same problem. Reproduce with the TypeScript examples and compare emitted arrows against the expected output shown. Done means defaults and async are preserved or the documented raw-source fallback is used.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Arrows copied from decorator metadata into the output lose parameter defaults and the async keyword. This changes runtime behavior: an async factory returns a value instead of a Promise, and a default value is no longer applied.

Repro

import {Component, Directive, Input} from '@angular/core';
@Directive({selector: '[d]'})
export class D {
  @Input({transform: (v: string = 'a') => v.length}) a = 0;
  @Input({transform: async (v: any) => 1}) b: any;
}
@Component({selector: 'c', template: '', providers: [{provide: 'T', useFactory: async (x: number = 1) => x}]})
export class C {}

OXC (main and #504 tip)

inputs:{a:[2,"a","a",(v) =>v.length],b:[2,"b","b",(v) =>1]}
// setClassMetadata
{a:[{type:Input,args:[{transform:(v) =>v.length}]}],b:[{type:Input,args:[{transform:(v) =>1}]}]}
i0.ɵɵProvidersFeature([{provide:"T",useFactory:(x) =>x}])

ngtsc 22.1.7

inputs: { a: [2, "a", "a", (v = 'a') => v.length], b: [2, "b", "b", async (v) => 1] }
{ a: [{ type: Input, args: [{ transform: (v = 'a') => v.length }] }], b: [{ type: Input, args: [{ transform: async (v) => 1 }] }] }
i0.ɵɵProvidersFeature([{ provide: 'T', useFactory: async (x = 1) => x }])

The .d.ts is already correct on the stack (ngAcceptInputType_a: string, ngAcceptInputType_b: any).

Where

crates/oxc_angular_compiler/src/output/oxc_converter.rs (main), convert_arrow_function_expression:

  • It reads only param.pattern (a BindingIdentifier) and ignores the parameter's default value.
  • It ignores arrow.r#async.

ArrowFunctionExpr (output/ast.rs) has no field for either. The function-expression path is worth checking for the same issue.

On main?

Yes.

Direction

Add async and default values to the output AST, or fall back to raw source (types stripped) when the arrow uses either, as is already done for destructured params.

Lingua principale
Rust
Stelle
232
Fork
21
Merge medio
1g 16h
PR unite (30g)
62

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di voidzero-dev/oxc-angular-compiler

Tutte le issue di voidzero-dev/oxc-angular-compiler

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.