Skip to content

Commit 28e4eff

Browse files
bowennivivian-hu-zz
authored andcommitted
<refactor>: Prepare for TypeScript v3.2.2 (#14847)
We're upgrading TypeScript to v3.2.2 in google3. This PR suppresses the compilation errors without actually upgrading the version of TypeScript. According to the comments, the top and bottom properties in ExtendedScrollToOptions are mutually exclusive. However when rewriting the bottom offset as a top offset both properties are defined. With the improved type inference in TypeScript 3.2 this is now a compilation error.
1 parent a8072c9 commit 28e4eff

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/cdk/scrolling/scrollable.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ export class CdkScrollable implements OnInit, OnDestroy {
9595

9696
// Rewrite the bottom offset as a top offset.
9797
if (options.bottom != null) {
98-
options.top = el.scrollHeight - el.clientHeight - options.bottom;
98+
(options as _Without<_Bottom> & _Top).top =
99+
el.scrollHeight - el.clientHeight - options.bottom;
99100
}
100101

101102
// Rewrite the right offset as a left offset.
102103
if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) {
103104
if (options.left != null) {
104-
options.right = el.scrollWidth - el.clientWidth - options.left;
105+
(options as _Without<_Left> & _Right).right =
106+
el.scrollWidth - el.clientWidth - options.left;
105107
}
106108

107109
if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {
@@ -111,7 +113,8 @@ export class CdkScrollable implements OnInit, OnDestroy {
111113
}
112114
} else {
113115
if (options.right != null) {
114-
options.left = el.scrollWidth - el.clientWidth - options.right;
116+
(options as _Without<_Right> & _Left).left =
117+
el.scrollWidth - el.clientWidth - options.right;
115118
}
116119
}
117120

0 commit comments

Comments
 (0)