@@ -185,7 +185,7 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
185
185
// input element. To ensure that bindings for `type` work, we need to sync the setter
186
186
// with the native property. Textarea elements don't support the type property or attribute.
187
187
if ( ! this . _isTextarea ( ) && getSupportedInputTypes ( ) . has ( this . _type ) ) {
188
- this . _elementRef . nativeElement . type = this . _type ;
188
+ ( this . _elementRef . nativeElement as HTMLInputElement ) . type = this . _type ;
189
189
}
190
190
}
191
191
protected _type = 'text' ;
@@ -221,16 +221,17 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
221
221
'week'
222
222
] . filter ( t => getSupportedInputTypes ( ) . has ( t ) ) ;
223
223
224
- constructor ( protected _elementRef : ElementRef < HTMLInputElement > ,
225
- protected _platform : Platform ,
226
- /** @docs -private */
227
- @Optional ( ) @Self ( ) public ngControl : NgControl ,
228
- @Optional ( ) _parentForm : NgForm ,
229
- @Optional ( ) _parentFormGroup : FormGroupDirective ,
230
- _defaultErrorStateMatcher : ErrorStateMatcher ,
231
- @Optional ( ) @Self ( ) @Inject ( MAT_INPUT_VALUE_ACCESSOR ) inputValueAccessor : any ,
232
- private _autofillMonitor : AutofillMonitor ,
233
- ngZone : NgZone ) {
224
+ constructor (
225
+ protected _elementRef : ElementRef < HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement > ,
226
+ protected _platform : Platform ,
227
+ /** @docs -private */
228
+ @Optional ( ) @Self ( ) public ngControl : NgControl ,
229
+ @Optional ( ) _parentForm : NgForm ,
230
+ @Optional ( ) _parentFormGroup : FormGroupDirective ,
231
+ _defaultErrorStateMatcher : ErrorStateMatcher ,
232
+ @Optional ( ) @Self ( ) @Inject ( MAT_INPUT_VALUE_ACCESSOR ) inputValueAccessor : any ,
233
+ private _autofillMonitor : AutofillMonitor ,
234
+ ngZone : NgZone ) {
234
235
super ( _defaultErrorStateMatcher , _parentForm , _parentFormGroup , ngControl ) ;
235
236
// If no input value accessor was explicitly specified, use the element as the input value
236
237
// accessor.
@@ -372,8 +373,9 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
372
373
// For a single-selection `<select>`, the label should float when the selected option has
373
374
// a non-empty display value. For a `<select multiple>`, the label *always* floats to avoid
374
375
// overlapping the label with the options.
375
- const selectElement = this . _elementRef . nativeElement ;
376
- return selectElement . multiple || ! this . empty || selectElement . options [ 0 ] . label ||
376
+ const selectElement = this . _elementRef . nativeElement as HTMLSelectElement ;
377
+
378
+ return selectElement . multiple || ! this . empty || ! ! selectElement . options [ 0 ] . label ||
377
379
this . focused ;
378
380
} else {
379
381
return this . focused || ! this . empty ;
0 commit comments