Fixes for Typescript 4.2

Typescript 4.2 reports the following errors without fixes:
  gr-repo-access.ts(302,59): error TS2339: Property 'name' does not
    exist on type 'never'.
  date-util.ts(166,47): error TS2345: Argument of type 'Options' is
    not assignable to parameter of type 'DateTimeFormatOptions'.
    Types of property 'year' are incompatible.

Change-Id: I2387d5664c6748a1194ca52a0560d1d961ca64e4
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
index 7b43dfc..80c58ca 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
@@ -297,9 +297,18 @@
     }
     // Restore inheritFrom.
     if (this._inheritsFrom) {
-      this._inheritsFrom = {...this.originalInheritsFrom};
-      this._inheritFromFilter =
-        'name' in this._inheritsFrom ? this._inheritsFrom.name : undefined;
+      // Can't assign this._inheritsFrom = {...this.originalInheritsFrom}
+      // directly, because this._inheritsFrom is declared as
+      // '...|null|undefined` and typescript reports error when trying
+      // to access .name property (because 'name' in null and 'name' in undefined
+      // lead to runtime error)
+      // After migrating to Typescript v4.2 the code below can be rewritten as
+      // const copy = {...this.originalInheritsFrom};
+      const copy: ProjectInfo | {} = this.originalInheritsFrom
+        ? {...this.originalInheritsFrom}
+        : {};
+      this._inheritsFrom = copy;
+      this._inheritFromFilter = 'name' in copy ? copy.name : undefined;
     }
     if (!this._local) {
       return;
diff --git a/polygerrit-ui/app/utils/date-util.ts b/polygerrit-ui/app/utils/date-util.ts
index 3af8c59..a780af5 100644
--- a/polygerrit-ui/app/utils/date-util.ts
+++ b/polygerrit-ui/app/utils/date-util.ts
@@ -90,15 +90,6 @@
   const diff = now.valueOf() - date.valueOf();
   return diff < 180 * Duration.DAY;
 }
-interface Options {
-  month?: string;
-  year?: string;
-  day?: string;
-  hour?: string;
-  hour12?: boolean;
-  minute?: string;
-  second?: string;
-}
 
 // TODO(dmfilippov): TS-Fix review this type. All fields here must be optional,
 // but this require some changes in the code. During JS->TS migration
@@ -118,7 +109,7 @@
 }
 
 export function formatDate(date: Date, format: string) {
-  const options: Options = {};
+  const options: Intl.DateTimeFormatOptions = {};
   if (format.includes('MM')) {
     if (format.includes('MMM')) {
       options.month = 'short';