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
Two-way binding ignores output type since angular 17.2+ #58971
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
When using two-way binding (aka banana-in-a-box), the output type is ignored or treated as any, after some testing it seems it started happening after v17.2.0.
This error stills happening in the current version (v19.0.1) and happens either with @Output, output or model, also happens when you bind a WritableSignal.
Example:
@Compotnent({selector: 'foo',
...
})exportclassFooComponent{
@Input()value: string|number|undefined;
@Output()valueChange=newEventEmitter<number>();}
@Component({template: ` <foo [(value)]="str"/> <!-- ERROR: doesn't complain with 'number' is not assignable to 'string' --> <foo [value]="str" (valueChange)="str = $event"/> <!-- OK: complains with 'number' is not assignable to 'string' --> `})exportclassAppComponent{str: string="";}
Following up: I've landed a fix for #59002, but it's currently disabled because it turned out to be somewhat breaking in our internal tests. We'll flip the flag to enable it in v20.
Activity
crisbeto commentedon Dec 6, 2024
Following up: I've landed a fix for #59002, but it's currently disabled because it turned out to be somewhat breaking in our internal tests. We'll flip the flag to enable it in v20.