Closed
Description
Describe the bug
When using a model signal (for example test = model<string>()
) and adding its output (testChange
), the library throws the error Component testChange is not an output!
Expected behavior
The component should accept the output for model signals (e.g. testChange
).
Reproduction
Stackblitz
Environment:
- Library version: [e.g. 10.8.1]
- Angular version: [e.g. 19.0.0]
Additional context
The problem raises cause in the method isOutputSignal the code checks if the value is an object. It works for outputs, but in the case of a model the property is actually a getter function.
I made some tests and changing the condition to:
private isOutputSignal(value: unknown): boolean {
return (
(typeof value === 'function' || typeof value === 'object') &&
value !== null &&
typeof (value as any)['subscribe'] === 'function'
);
}
makes it work.
I can open a PR, but let me know if you have any feedback regarding the issue, cause I'm not sure if I'm missing something here.
Thank you for the amazing work!