Skip to content

Commit 22b6968

Browse files
authored
ref: Remove TS enums in favor of type constant strings (#12558)
1 parent f05d616 commit 22b6968

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

src/components/platformCategorySection.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import {getCurrentPlatformOrGuide} from 'sentry-docs/docTree';
22
import {serverContext} from 'sentry-docs/serverContext';
3-
import {Platform, PlatformGuide} from 'sentry-docs/types';
3+
import {Platform, PlatformCategory, PlatformGuide} from 'sentry-docs/types';
44

55
type Props = {
66
children?: React.ReactNode;
77
noGuides?: boolean;
8-
notSupported?: string[];
8+
notSupported?: PlatformCategory[];
99
platform?: string;
10-
supported?: string[];
10+
supported?: PlatformCategory[];
1111
};
1212

1313
const isSupported = (
1414
platformOrGuide: Platform | PlatformGuide,
15-
supported: string[],
16-
notSupported: string[]
15+
supported: PlatformCategory[],
16+
notSupported: PlatformCategory[]
1717
): boolean => {
1818
if (platformOrGuide.categories === null) {
1919
return false;

src/types/platform.tsx

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -138,30 +138,18 @@ export interface PlatformConfig {
138138
}
139139

140140
/**
141-
* @see PlatformConfig.caseStyle
141+
* The case style of a platform defines the casing used for sentry SDK
142+
* functions / keywords. For example `before-send` would become `BeforeSend`
143+
* if the caseStyle is configured as PascalCase.
142144
*/
143-
export enum PlatformCaseStyle {
144-
CANONICAL = 'canonical',
145-
CAMEL_CASE = 'camelCase',
146-
PASCAL_CASE = 'PascalCase',
147-
SNAKE_CASE = 'snake_case',
148-
}
145+
export type PlatformCaseStyle = 'canonical' | 'camelCase' | 'PascalCase' | 'snake_case';
149146

150147
/**
151-
* @see PlatformConfig.supportLevel
148+
* Is this a first-party or third-party SDK?
152149
*/
153-
export enum PlatformSupportLevel {
154-
PRODUCTION = 'production',
155-
COMMUNITY = 'community',
156-
}
150+
export type PlatformSupportLevel = 'production' | 'community';
157151

158152
/**
159-
* @see PlatformConfig.categories
153+
* Possible types of categories.
160154
*/
161-
export enum PlatformCategory {
162-
BROWSER = 'browser',
163-
DESKTOP = 'desktop',
164-
MOBILE = 'mobile',
165-
SERVER = 'server',
166-
SERVERLESS = 'serverless',
167-
}
155+
export type PlatformCategory = 'browser' | 'desktop' | 'mobile' | 'server' | 'serverless';

0 commit comments

Comments
 (0)