Skip to content

fix: add non-null assertions for non-nullable input bindings #20136

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

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/dev-app/datepicker/datepicker-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h2>Result</h2>
[(ngModel)]="date"
[min]="minDate"
[max]="maxDate"
[matDatepickerFilter]="filterOdd ? dateFilter : undefined"
[matDatepickerFilter]="filterOdd ? dateFilter : undefined!"
[disabled]="inputDisabled"
(dateInput)="onDateInput($event)"
(dateChange)="onDateChange($event)">
Expand Down Expand Up @@ -81,7 +81,7 @@ <h2>Result</h2>
[min]="minDate"
[max]="maxDate"
[disabled]="inputDisabled"
[matDatepickerFilter]="filterOdd ? dateFilter : undefined"
[matDatepickerFilter]="filterOdd ? dateFilter : undefined!"
placeholder="Pick a date">
<mat-datepicker-toggle [for]="resultPicker2"></mat-datepicker-toggle>
<mat-datepicker
Expand All @@ -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 : undefined" disabled>
[matDatepickerFilter]="filterOdd ? dateFilter : undefined!" disabled>
<mat-datepicker #datePicker1 [touchUi]="touch" [startAt]="startAt"
[startView]="yearView ? 'year' : 'month'"></mat-datepicker>
</mat-form-field>
Expand All @@ -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 : undefined">
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : undefined!">
<mat-datepicker #datePicker2 [touchUi]="touch" [startAt]="startAt"
[startView]="yearView ? 'year' : 'month'"></mat-datepicker>
</mat-form-field>
Expand All @@ -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 : undefined">
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : undefined!">
<mat-datepicker #datePicker3 [touchUi]="touch" [disabled]="false" [startAt]="startAt"
[startView]="yearView ? 'year' : 'month'"></mat-datepicker>
</mat-form-field>
Expand All @@ -144,7 +144,7 @@ <h2>Datepicker with value property binding</h2>
This breaks strict template type checking. What should we do here?
-->
<input matInput [matDatepicker]="datePicker4" [value]="date" [min]="minDate"
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : undefined">
[max]="maxDate" [matDatepickerFilter]="filterOdd ? dateFilter : undefined!">
<mat-datepicker #datePicker4 [touchUi]="touch" [startAt]="startAt"
[startView]="yearView ? 'year' : 'month'"></mat-datepicker>
</mat-form-field>
Expand Down Expand Up @@ -183,7 +183,7 @@ <h2>Range picker</h2>
[disabled]="inputDisabled"
[comparisonStart]="comparisonStart"
[comparisonEnd]="comparisonEnd"
[dateFilter]="filterOdd ? dateFilter : undefined">
[dateFilter]="filterOdd ? dateFilter : undefined!">
<input matStartDate formControlName="start" placeholder="Start date"/>
<input matEndDate formControlName="end" placeholder="End date"/>
</mat-date-range-input>
Expand All @@ -207,7 +207,7 @@ <h2>Range picker</h2>
[disabled]="inputDisabled"
[comparisonStart]="comparisonStart"
[comparisonEnd]="comparisonEnd"
[dateFilter]="filterOdd ? dateFilter : undefined">
[dateFilter]="filterOdd ? dateFilter : undefined!">
<input matStartDate formControlName="start" placeholder="Start date"/>
<input matEndDate formControlName="end" placeholder="End date"/>
</mat-date-range-input>
Expand All @@ -232,7 +232,7 @@ <h2>Range picker</h2>
[disabled]="inputDisabled"
[comparisonStart]="comparisonStart"
[comparisonEnd]="comparisonEnd"
[dateFilter]="filterOdd ? dateFilter : undefined">
[dateFilter]="filterOdd ? dateFilter : undefined!">
<input matStartDate formControlName="start" placeholder="Start date"/>
<input matEndDate formControlName="end" placeholder="End date"/>
</mat-date-range-input>
Expand Down
4 changes: 2 additions & 2 deletions src/dev-app/stepper/stepper-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h3>Linear Vertical Stepper Demo using a single form</h3>
<form [formGroup]="formGroup">
<mat-vertical-stepper #linearVerticalStepper="matVerticalStepper" formArrayName="formArray"
[linear]="!isNonLinear" [disableRipple]="disableRipple">
<mat-step formGroupName="0" [stepControl]="formArray?.get([0]) === null ? undefined : formArray?.get([0])!">
<mat-step formGroupName="0" [stepControl]="formArray?.get([0]) === null ? undefined! : formArray?.get([0])!">
<ng-template matStepLabel>Fill out your name</ng-template>
<mat-form-field>
<mat-label>First name</mat-label>
Expand All @@ -28,7 +28,7 @@ <h3>Linear Vertical Stepper Demo using a single form</h3>
</div>
</mat-step>

<mat-step formGroupName="1" [stepControl]="formArray?.get([1]) === null ? undefined : formArray?.get([1])!"
<mat-step formGroupName="1" [stepControl]="formArray?.get([1]) === null ? undefined! : formArray?.get([1])!"
optional>
<ng-template matStepLabel>
<div>Fill out your email address</div>
Expand Down
2 changes: 1 addition & 1 deletion src/material/paginator/paginator.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<mat-form-field
*ngIf="_displayedPageSizeOptions.length > 1"
[appearance]="_formFieldAppearance"
[appearance]="_formFieldAppearance!"
[color]="color"
class="mat-paginator-page-size-select">
<mat-select
Expand Down
2 changes: 1 addition & 1 deletion src/material/select/select.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[cdkConnectedOverlayOrigin]="origin"
[cdkConnectedOverlayOpen]="panelOpen"
[cdkConnectedOverlayPositions]="_positions"
[cdkConnectedOverlayMinWidth]="_triggerRect?.width"
[cdkConnectedOverlayMinWidth]="_triggerRect?.width!"
[cdkConnectedOverlayOffsetY]="_offsetY"
(backdropClick)="close()"
(attach)="_onAttached()"
Expand Down