Browse Source

ref(types): Consolidate platform key and type (#57349)

`PlatformType` was defined as `PlatformKey | 'cocoa' | 'objc'`.
This PR adds `'cocoa'` and `'objc'` to `PlatformKey` and removes
`PlatformType`.

Relates to https://github.com/getsentry/sentry/issues/57047
ArthurKnaus 1 year ago
parent
commit
8f93f3b1a0

+ 2 - 2
static/app/components/events/interfaces/crashContent/exception/index.tsx

@@ -1,5 +1,5 @@
 import ErrorBoundary from 'sentry/components/errorBoundary';
-import {ExceptionType, Group, PlatformType, Project} from 'sentry/types';
+import {ExceptionType, Group, PlatformKey, Project} from 'sentry/types';
 import {Event} from 'sentry/types/event';
 import {StackType, StackView} from 'sentry/types/stacktrace';
 
@@ -10,7 +10,7 @@ type Props = {
   event: Event;
   hasHierarchicalGrouping: boolean;
   newestFirst: boolean;
-  platform: PlatformType;
+  platform: PlatformKey;
   projectSlug: Project['slug'];
   stackType: StackType;
   groupingCurrentLevel?: Group['metadata']['current_level'];

+ 2 - 2
static/app/components/events/interfaces/crashContent/exception/rawContent.tsx

@@ -7,7 +7,7 @@ import ClippedBox from 'sentry/components/clippedBox';
 import LoadingError from 'sentry/components/loadingError';
 import LoadingIndicator from 'sentry/components/loadingIndicator';
 import {t} from 'sentry/locale';
-import {ExceptionType, Organization, PlatformType, Project} from 'sentry/types';
+import {ExceptionType, Organization, PlatformKey, Project} from 'sentry/types';
 import {Event} from 'sentry/types/event';
 import withApi from 'sentry/utils/withApi';
 import withOrganization from 'sentry/utils/withOrganization';
@@ -17,7 +17,7 @@ import rawStacktraceContent from '../stackTrace/rawContent';
 type Props = {
   api: Client;
   eventId: Event['id'];
-  platform: PlatformType;
+  platform: PlatformKey;
   projectSlug: Project['slug'];
   type: 'original' | 'minified';
   // XXX: Organization is NOT available for Shared Issues!

+ 2 - 2
static/app/components/events/interfaces/crashContent/exception/stackTrace.tsx

@@ -3,7 +3,7 @@ import {FrameSourceMapDebuggerData} from 'sentry/components/events/interfaces/so
 import Panel from 'sentry/components/panels/panel';
 import {IconWarning} from 'sentry/icons';
 import {t} from 'sentry/locale';
-import {ExceptionValue, Group, PlatformType} from 'sentry/types';
+import {ExceptionValue, Group, PlatformKey} from 'sentry/types';
 import {Event} from 'sentry/types/event';
 import {StackView} from 'sentry/types/stacktrace';
 import {defined} from 'sentry/utils';
@@ -18,7 +18,7 @@ type Props = {
   data: ExceptionValue['stacktrace'];
   event: Event;
   hasHierarchicalGrouping: boolean;
-  platform: PlatformType;
+  platform: PlatformKey;
   stacktrace: ExceptionValue['stacktrace'];
   expandFirstFrame?: boolean;
   frameSourceMapDebuggerData?: FrameSourceMapDebuggerData[];

+ 2 - 2
static/app/components/events/interfaces/crashContent/index.tsx

@@ -1,4 +1,4 @@
-import {ExceptionType, ExceptionValue, PlatformType} from 'sentry/types';
+import {ExceptionType, ExceptionValue, PlatformKey} from 'sentry/types';
 
 import {ExceptionContent} from './exception';
 import {StackTraceContent} from './stackTrace';
@@ -29,7 +29,7 @@ export function CrashContent({
   exception,
   stacktrace,
 }: Props) {
-  const platform = (event.platform ?? 'other') as PlatformType;
+  const platform = (event.platform ?? 'other') as PlatformKey;
 
   if (exception) {
     return (

+ 2 - 2
static/app/components/events/interfaces/crashContent/stackTrace/content.tsx

@@ -5,7 +5,7 @@ import GuideAnchor from 'sentry/components/assistant/guideAnchor';
 import {FrameSourceMapDebuggerData} from 'sentry/components/events/interfaces/sourceMapsDebuggerModal';
 import Panel from 'sentry/components/panels/panel';
 import {t} from 'sentry/locale';
-import {Frame, Organization, PlatformType} from 'sentry/types';
+import {Frame, Organization, PlatformKey} from 'sentry/types';
 import {Event} from 'sentry/types/event';
 import {StackTraceMechanism, StacktraceType} from 'sentry/types/stacktrace';
 import {defined} from 'sentry/utils';
@@ -31,7 +31,7 @@ type DefaultProps = {
 type Props = {
   data: StacktraceType;
   event: Event;
-  platform: PlatformType;
+  platform: PlatformKey;
   className?: string;
   frameSourceMapDebuggerData?: FrameSourceMapDebuggerData[];
   hideIcon?: boolean;

+ 2 - 2
static/app/components/events/interfaces/crashContent/stackTrace/hierarchicalGroupingContent.tsx

@@ -5,7 +5,7 @@ import List from 'sentry/components/list';
 import ListItem from 'sentry/components/list/listItem';
 import Panel from 'sentry/components/panels/panel';
 import {t} from 'sentry/locale';
-import {Frame, Group, PlatformType} from 'sentry/types';
+import {Frame, Group, PlatformKey} from 'sentry/types';
 import {Event} from 'sentry/types/event';
 import {StacktraceType} from 'sentry/types/stacktrace';
 import {defined} from 'sentry/utils';
@@ -18,7 +18,7 @@ import StacktracePlatformIcon from './platformIcon';
 type Props = {
   data: StacktraceType;
   event: Event;
-  platform: PlatformType;
+  platform: PlatformKey;
   className?: string;
   expandFirstFrame?: boolean;
   groupingCurrentLevel?: Group['metadata']['current_level'];

+ 2 - 2
static/app/components/events/interfaces/crashContent/stackTrace/index.tsx

@@ -1,7 +1,7 @@
 import styled from '@emotion/styled';
 
 import ErrorBoundary from 'sentry/components/errorBoundary';
-import {PlatformType} from 'sentry/types';
+import {PlatformKey} from 'sentry/types';
 import {Event} from 'sentry/types/event';
 import {StacktraceType, StackView} from 'sentry/types/stacktrace';
 import {isNativePlatform} from 'sentry/utils/platform';
@@ -18,7 +18,7 @@ type Props = Pick<
   event: Event;
   hasHierarchicalGrouping: boolean;
   newestFirst: boolean;
-  platform: PlatformType;
+  platform: PlatformKey;
   stacktrace: StacktraceType;
   inlined?: boolean;
   lockAddress?: string;

+ 2 - 2
static/app/components/events/interfaces/crashContent/stackTrace/nativeContent.tsx

@@ -4,7 +4,7 @@ import styled from '@emotion/styled';
 import Panel from 'sentry/components/panels/panel';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import {Frame, Group, PlatformType} from 'sentry/types';
+import {Frame, Group, PlatformKey} from 'sentry/types';
 import {Event} from 'sentry/types/event';
 import {StacktraceType} from 'sentry/types/stacktrace';
 import {defined} from 'sentry/utils';
@@ -21,7 +21,7 @@ import {
 type Props = {
   data: StacktraceType;
   event: Event;
-  platform: PlatformType;
+  platform: PlatformKey;
   expandFirstFrame?: boolean;
   groupingCurrentLevel?: Group['metadata']['current_level'];
   hiddenFrameCount?: number;

+ 2 - 2
static/app/components/events/interfaces/exception.tsx

@@ -1,5 +1,5 @@
 import {t} from 'sentry/locale';
-import {ExceptionType, Group, PlatformType, Project} from 'sentry/types';
+import {ExceptionType, Group, PlatformKey, Project} from 'sentry/types';
 import {EntryType, Event} from 'sentry/types/event';
 import {StackType, StackView} from 'sentry/types/stacktrace';
 
@@ -40,7 +40,7 @@ export function Exception({
 
   const meta = event._meta?.entries?.[entryIndex]?.data?.values;
 
-  function getPlatform(): PlatformType {
+  function getPlatform(): PlatformKey {
     const dataValue = data.values?.find(
       value => !!value.stacktrace?.frames?.some(frame => !!frame.platform)
     );

+ 2 - 2
static/app/components/events/interfaces/exceptionV2.tsx

@@ -1,5 +1,5 @@
 import {t} from 'sentry/locale';
-import {ExceptionType, Group, PlatformType, Project} from 'sentry/types';
+import {ExceptionType, Group, PlatformKey, Project} from 'sentry/types';
 import {EntryType, Event} from 'sentry/types/event';
 import {StackType, StackView} from 'sentry/types/stacktrace';
 
@@ -40,7 +40,7 @@ export function ExceptionV2({
 
   const meta = event._meta?.entries?.[entryIndex]?.data?.values;
 
-  function getPlatform(): PlatformType {
+  function getPlatform(): PlatformKey {
     const dataValue = data.values?.find(
       value => !!value.stacktrace?.frames?.some(frame => !!frame.platform)
     );

Some files were not shown because too many files changed in this diff