Skip to content

fix(text-field): correctly check _initialHeight #17900

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
Dec 10, 2019
Merged
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
7 changes: 5 additions & 2 deletions src/cdk/text-field/autosize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
ngAfterViewInit() {
if (this._platform.isBrowser) {
// Remember the height which we started with in case autosizing is disabled
this._initialHeight = this._textareaElement.style.height;
// TODO: as any works around `height` being nullable in TS3.6, but non-null in 3.7.
// Remove once on TS3.7.
this._initialHeight = this._textareaElement.style.height as any;

this.resizeToFitContent();

Expand Down Expand Up @@ -247,7 +249,8 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {
if (this._initialHeight === undefined) {
return;
}
this._textareaElement.style.height = this._initialHeight;
// TODO: "as any" inserted for migration to TS3.7.
this._textareaElement.style.height = this._initialHeight as any;
}

// In Ivy the `host` metadata will be merged, whereas in ViewEngine it is overridden. In order
Expand Down