-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: ensure components can be built with ivy strict template type checking #16373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cb63d4f
9b25d9c
e7ca296
f15eac5
8a9500f
b31b5af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ <h2>Result</h2> | |
[(ngModel)]="date" | ||
[min]="minDate" | ||
[max]="maxDate" | ||
[matDatepickerFilter]="filterOdd ? dateFilter : null" | ||
[matDatepickerFilter]="filterOdd ? dateFilter : undefined" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's talk about this one at the team meeting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To provide some context for later: @Input()
set matDatepickerFilter(value: (date: D | null) => boolean) { With strict null checks, type checking should technically complain for both Chatted with Joost and it looks like it is because ngtsc uses |
||
[disabled]="inputDisabled" | ||
(dateInput)="onDateInput($event)" | ||
(dateChange)="onDateChange($event)"> | ||
|
@@ -81,7 +81,7 @@ <h2>Result</h2> | |
[min]="minDate" | ||
[max]="maxDate" | ||
[disabled]="inputDisabled" | ||
[matDatepickerFilter]="filterOdd ? dateFilter : null" | ||
[matDatepickerFilter]="filterOdd ? dateFilter : undefined" | ||
placeholder="Pick a date"> | ||
<mat-datepicker-toggle [for]="resultPicker2"></mat-datepicker-toggle> | ||
<mat-datepicker | ||
|
@@ -99,7 +99,7 @@ <h2>Input disabled datepicker</h2> | |
<mat-form-field> | ||
<mat-label>Input disabled</mat-label> | ||
<input matInput [matDatepicker]="datePicker1" [(ngModel)]="date" [min]="minDate" [max]="maxDate" | ||
[matDatepickerFilter]="filterOdd ? dateFilter : null" disabled> | ||
[matDatepickerFilter]="filterOdd ? dateFilter : undefined" disabled> | ||
<mat-datepicker #datePicker1 [touchUi]="touch" [startAt]="startAt" | ||
[startView]="yearView ? 'year' : 'month'"></mat-datepicker> | ||
</mat-form-field> | ||
|
@@ -111,7 +111,7 @@ <h2>Input disabled via FormControl</h2> | |
<mat-form-field> | ||
<mat-label>FormControl disabled</mat-label> | ||
<input matInput [matDatepicker]="datePicker2" [formControl]="dateCtrl" [min]="minDate" | ||
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : null"> | ||
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : undefined"> | ||
<mat-datepicker #datePicker2 [touchUi]="touch" [startAt]="startAt" | ||
[startView]="yearView ? 'year' : 'month'"></mat-datepicker> | ||
</mat-form-field> | ||
|
@@ -127,7 +127,7 @@ <h2>Input disabled, datepicker popup enabled</h2> | |
<mat-form-field> | ||
<mat-label>Input disabled, datepicker enabled</mat-label> | ||
<input matInput disabled [matDatepicker]="datePicker3" [(ngModel)]="date" [min]="minDate" | ||
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : null"> | ||
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : undefined"> | ||
<mat-datepicker #datePicker3 [touchUi]="touch" [disabled]="false" [startAt]="startAt" | ||
[startView]="yearView ? 'year' : 'month'"></mat-datepicker> | ||
</mat-form-field> | ||
|
@@ -138,8 +138,14 @@ <h2>Datepicker with value property binding</h2> | |
<mat-datepicker-toggle [for]="datePicker4"></mat-datepicker-toggle> | ||
<mat-form-field> | ||
<mat-label>Value binding</mat-label> | ||
<input matInput [matDatepicker]="datePicker4" [value]="date" [min]="minDate" | ||
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : null"> | ||
<!-- | ||
TODO for reviewer: Angular sets the inputs for both directives on the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to talk about this at the framework meeting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was there an outcome from the discussion of this at the framework meeting? This is an issue that I'm still running into and I don't have a solution. |
||
input element here. e.g. [value] is set for MatInput and MatDatepicker. | ||
MatInput#value expects a string whereas MatDatepicker#value expects a date. | ||
This breaks strict template type checking. What should we do here? | ||
--> | ||
<input matInput [matDatepicker]="datePicker4" [value]="$any(date)" [min]="minDate" | ||
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : undefined"> | ||
<mat-datepicker #datePicker4 [touchUi]="touch" [startAt]="startAt" | ||
[startView]="yearView ? 'year' : 'month'"></mat-datepicker> | ||
</mat-form-field> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's talk about this one at the team meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this one I'm not sure if there is actually an issue? With strict type checking it makes sense to me that it expects a boolean here and not an overlay ref (even though it is truthy). example