From 28e4eff3d13bac499abf833897520eb1f78bc756 Mon Sep 17 00:00:00 2001 From: Bowen Ni Date: Thu, 17 Jan 2019 11:31:10 -0800 Subject: [PATCH] : 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. --- src/cdk/scrolling/scrollable.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cdk/scrolling/scrollable.ts b/src/cdk/scrolling/scrollable.ts index 4a6e44157ef..66464f77640 100644 --- a/src/cdk/scrolling/scrollable.ts +++ b/src/cdk/scrolling/scrollable.ts @@ -95,13 +95,15 @@ export class CdkScrollable implements OnInit, OnDestroy { // Rewrite the bottom offset as a top offset. if (options.bottom != null) { - options.top = el.scrollHeight - el.clientHeight - options.bottom; + (options as _Without<_Bottom> & _Top).top = + el.scrollHeight - el.clientHeight - options.bottom; } // Rewrite the right offset as a left offset. if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) { if (options.left != null) { - options.right = el.scrollWidth - el.clientWidth - options.left; + (options as _Without<_Left> & _Right).right = + el.scrollWidth - el.clientWidth - options.left; } if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) { @@ -111,7 +113,8 @@ export class CdkScrollable implements OnInit, OnDestroy { } } else { if (options.right != null) { - options.left = el.scrollWidth - el.clientWidth - options.right; + (options as _Without<_Right> & _Left).left = + el.scrollWidth - el.clientWidth - options.right; } }