Browse Source

ref(ui): Declare release & resource class context types (#65515)

Scott Cooper 1 year ago
parent
commit
ca21e5c34c

+ 3 - 1
static/app/components/deprecatedAsyncComponent.tsx

@@ -1,5 +1,5 @@
 import {Component} from 'react';
-import type {RouteComponentProps} from 'react-router';
+import type {RouteComponentProps, RouteContextInterface} from 'react-router';
 import * as Sentry from '@sentry/react';
 import isEqual from 'lodash/isEqual';
 
@@ -152,6 +152,8 @@ class DeprecatedAsyncComponent<
     document.removeEventListener('visibilitychange', this.visibilityReloader);
   }
 
+  declare context: {router: RouteContextInterface};
+
   /**
    * Override this flag to have the component reload its state when the window
    * becomes visible again. This will set the loading and reloading state, but

+ 8 - 1
static/app/components/forms/model.tsx

@@ -13,7 +13,14 @@ import {defined} from 'sentry/utils';
 type Snapshot = Map<string, FieldValue>;
 type SaveSnapshot = (() => number) | null;
 
-export type FieldValue = string | number | boolean | Choice | Set<string> | undefined; // is undefined valid here?
+export type FieldValue =
+  | string
+  | string[]
+  | Set<string>
+  | number
+  | boolean
+  | Choice
+  | undefined; // is undefined valid here?
 
 export type FormOptions = {
   /**

+ 1 - 0
static/app/views/releases/detail/commitsAndFiles/withReleaseRepos.tsx

@@ -68,6 +68,7 @@ function withReleaseRepos<P extends DependentProps>(
       }
     }
 
+    declare context: React.ContextType<typeof ReleaseContext>;
     static contextType = ReleaseContext;
 
     setActiveReleaseRepo(props: P & HoCsProps) {

+ 1 - 0
static/app/views/settings/organizationDeveloperSettings/resourceSubscriptions.tsx

@@ -49,6 +49,7 @@ export default class Subscriptions extends Component<Props> {
     }
   }
 
+  declare context: Required<React.ContextType<typeof FormContext>>;
   static contextType = FormContext;
 
   onChange = (resource: Resource, checked: boolean) => {