-
Notifications
You must be signed in to change notification settings - Fork 27k
Open
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilerbugcompiler: template type-checkingstate: has PR
Milestone
Description
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',
...
})
export class FooComponent {
@Input() value: string | number | undefined;
@Output() valueChange = new EventEmitter<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' -->
`
})
export class AppComponent {
str: string = "";
}Reproduction with ng17.0: https://stackblitz.com/edit/stackblitz-starters-krwib7?file=src%2Fmain.ts
Reproduction with ng17.2: https://stackblitz.com/edit/stackblitz-starters-tky4w1?file=src%2Fmain.ts
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-tky4w1?file=src%2Fmain.ts
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 17.2.3
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64
Angular: 17.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1702.3
@angular-devkit/build-angular 17.2.3
@angular-devkit/core 17.2.3
@angular-devkit/schematics 17.2.3
@angular/cli 17.2.3
@schematics/angular 17.2.3
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.10
Anything else?
No response
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilerbugcompiler: template type-checkingstate: has PR