8000 fix typescript error · mozilla/perfcompare@e56ebb9 · GitHub
[go: up one dir, main page]

Skip to content

Commit e56ebb9

Browse files
committed
fix typescript error
1 parent 2121223 commit e56ebb9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/types/types.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,25 @@ export type FilteredResults = {
8383
isFiltered: boolean;
8484
};
8585

86+
export type PlatformOS =
87+
| 'linux64'
88+
| 'linux1804'
89+
| 'linux2204'
90+
| 'osx'
91+
| 'macosx1014'
92+
| 'macosx1015'
93+
| 'macosx1100'
94+
| 'macosx1300'
95+
| 'macosx1400'
96+
| 'macosx1470'
97+
| 'win32'
98+
| 'win64'
99+
| 'windows7'
100+
| 'windows10'
101+
| 'windows11'
102+
| 'windows2012'
103+
| 'windows';
104+
86105
// TODO: Needs review: as new platforms are available the type will need updates
87106
export type Platform =
88107
| 'linux32'

src/utils/platform.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { PlatformShortName } from '../types/state';
2+
import { PlatformOS } from '../types/types';
23

34
export const getPlatformShortName = (
45
platformName: string,
@@ -35,7 +36,7 @@ const osMapping = {
3536
};
3637

3738
const extractPlatformWithOs = (platform: string) => {
38-
const name = osMapping[platform.split('-')[0]] as string;
39+
const name = osMapping[platform.split('-')[0] as PlatformOS];
3940

4041
if (name) return name;
4142

0 commit comments

Comments
 (0)
0