Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Dynamic host attribute values are rejected (and two local-compilation-only transform cases)

Abierto
#627 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@edbzn ya está trabajando en esto.

Desde el 25/10/2026.

  • #639 de @edbzn — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
angular, rust
Área
backend

Línea de trabajo

Start with evaluateHostExpressionBindings in annotations/directive/src/shared.ts and follow how parseHostBindings emits plain host attributes; compare that path with the [prop], (event), class, and style handling described here. The expected output is an expression in hostAttrs, matching ngc's hostAttrs: ["test", test], while cases 2 and 3 should retain their full-mode diagnostics. The linked open pull request indicates this work is already underway.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

Three Angular ngtsc specs compile with ngtsc but get a compile error from oxc, so a Vite build fails. Found by running Angular v22.0.0's ngtsc emit specs against oxc main (04cb3b2). Only case 1 is a bug in oxc. Cases 2 and 3 compile only in ngtsc's local compilation mode. That mode skips these checks because a separate full build checks them, and oxc already matches the full-mode diagnostics on purpose (#494).

1. Dynamic host attribute value (bug)

ngtsc_spec.ts: "should accept dynamic host attribute bindings"

// other.d.ts
export declare const foo: any;
// test.ts
import {Component} from '@angular/core';
import {foo} from './other';

const test = foo.bar();

@Component({selector: 'test', template: '', host: {'test': test}})
export class TestCmp {}
Actual
@Component.host depends on 'foo', which is imported from another module. OXC compiles one file at a time and cannot evaluate values from other files.

The error is the same with and without resolveImportedValues. A same-file dynamic value (host: {role: make()}) is also rejected: ... could not be determined statically. OXC does not support dynamic host attribute values.

Expected (ngc)
hostAttrs: ["test", test]

Cause

evaluateHostExpressionBindings (annotations/directive/src/shared.ts) turns a DynamicValue into new WrappedNodeExpr(value.node). parseHostBindings then emits it as is for a plain attribute, and rejects it only for [prop], (event), class and style. oxc stores host attribute values as strings, so it has no way to emit an expression.

2. Input transform from a namespace import (not a bug)

local_compilation_spec.ts: "should generate input info for transform function imported externally using namespace"

import * as n from './some_where';
// ...
@Input({transform: n.externalFunc}) x: string = '';

Actual: Input transform function could not be referenced Value is a reference to 'externalFunc'. Local mode emits inputs: { x: [2, "x", "x", n.externalFunc] }.

3. Inline transform with an untyped parameter (not a bug)

local_compilation_spec.ts: "should not check inline function param type"

@Input({transform: v => v + 'TRANSFORMED!'}) x: string = '';

Actual: Input transform function first parameter must have a type Value could not be determined statically. Local mode emits inputs: { x: [2, "x", "x", v => v + 'TRANSFORMED!'] }.

Why 2 and 3 are not bugs

parseDecoratorInputTransformFunction skips every transform check when compilationMode === LOCAL, "because usually the type check is done in a separate build which runs in full compilation mode". In full mode, which is what ng build uses, ngtsc reports both errors:

  • case 3 matches ngtsc_spec.ts "should produce a diangostic if the transform function first parameter has no arguments" (transform: (val) => 1);
  • for case 2, a namespace member has no identity in the file (getIdentityIn returns null), and #494 checked this against ngtsc 22.1.7 (namespace_imported_transform_cannot_be_referenced).

oxc is the only compiler in a Vite build, so no other build would check these. Dropping the checks would let code through that ng build rejects. I left both cases as they are.

Lenguaje dominante
Rust
Estrellas
244
Forks
26
Merge medio
23 h 16 min
PR fusionados (30 d)
96

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de voidzero-dev/oxc-angular-compiler

Todos los issues de voidzero-dev/oxc-angular-compiler

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.