You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit df18eb1
Browse filesBrowse the repository at this point in the historyBrowse files
fix(directive): read member @Input/@output arguments through the evaluator, like ngtsc
A same-file value passed to a member decorator lost its alias with no
error: `const NAME = 'y'` with `@Input(NAME)` compiled to `x: "x"` (ngtsc:
`x: [0, "y", "x"]`), `@Input(OPTS)` with `const OPTS = {alias: 'y',
required: true}` dropped the alias and `required`, and `@Output(NAME)`
compiled to `e: "e"` (ngtsc: `e: "y"`). Only literals were read.
Like ngtsc's `tryParseInputFieldMapping` / `tryParseDecoratorOutput`, the
argument is now evaluated (checked against @angular/compiler-cli 22.1.7):
- `@Input`: a string (a const, `let`, template literal, `'a' + 'b'`,
`as const`, a ternary, a same-file function call, ...) is the alias; an
object (a const, a spread, `{alias: NAME}`) gives `alias`, `required`
and `transform`. This holds for the `ɵdir`/`ɵcmp` inputs, the `.d.ts`
and NAPI's `extractComponentMetadataSync`, which now also gets the
transform ngtsc emits.
- `@Output`: a string is the alias.
- ngtsc's errors: "@input can have at most one argument, got N
argument(s)" (named as written: `@In` for `import {Input as In}`),
"@input decorator argument must resolve to a string or an object
literal" (numbers, booleans, `undefined`, arrays, enum members,
`declare`d values; `null` is allowed), and the same two for `@Output`
("must resolve to a string", which also rejects `null` and objects).
- An imported `@Output(NAME)` (`ns.NAME`, `` `${NAME}` ``, a local copy)
gets the "imported from another module" error, like `@Input(OPTS)`.
The public `extract_*` functions, which don't get the file's imports,
still read literals only.
Left as before: ngtsc's "Input/Output 'y' is bound to both ..." error,
and `@Output()` on a setter (ngtsc compiles it; oxc doesn't read outputs
from methods).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
0 commit comments