@@ -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,7 +221,7 @@ 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 > ,
224
+ constructor ( protected _elementRef : ElementRef < HTMLInputElement | HTMLSelectElement > ,
225
225
protected _platform : Platform ,
226
226
/** @docs -private */
227
227
@Optional ( ) @Self ( ) public ngControl : NgControl ,
@@ -372,8 +372,9 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
372
372
// For a single-selection `<select>`, the label should float when the selected option has
373
373
// a non-empty display value. For a `<select multiple>`, the label *always* floats to avoid
374
374
// overlapping the label with the options.
375
- const selectElement = this . _elementRef . nativeElement ;
376
- return selectElement . multiple || ! this . empty || selectElement . options [ 0 ] . label ||
375
+ const selectElement = this . _elementRef . nativeElement as HTMLSelectElement ;
376
+
377
+ return selectElement . multiple || ! this . empty || ! ! selectElement . options [ 0 ] . label ||
377
378
this . focused ;
378
379
} else {
379
380
return this . focused || ! this . empty ;
0 commit comments