Skip to content

Commit

Permalink
chore(device-utils, suite): add FirmwareVersionString type
Browse files Browse the repository at this point in the history
  • Loading branch information
komret committed Dec 3, 2024
1 parent 8dc0023 commit 94a4485
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions packages/device-utils/src/firmwareUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FirmwareType, VersionArray } from '@trezor/connect';

import { isDeviceInBootloaderMode } from './modeUtils';
import { PartialDevice } from './types';
import { FirmwareVersionString, PartialDevice } from './types';

export const getFirmwareRevision = (device?: PartialDevice) => device?.features?.revision || '';

Expand All @@ -20,9 +20,7 @@ export const getFirmwareVersionArray = (device?: PartialDevice): VersionArray |
return [features.major_version, features.minor_version, features.patch_version];
};

export const getFirmwareVersion = (
device?: PartialDevice,
): '' | `${number}.${number}.${number}` => {
export const getFirmwareVersion = (device?: PartialDevice): '' | FirmwareVersionString => {
if (!device?.features) {
return '';
}
Expand Down
2 changes: 2 additions & 0 deletions packages/device-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export type PartialDevice = {
features?: Device['features'];
firmwareType?: Device['firmwareType'];
};

export type FirmwareVersionString = `${number}.${number}.${number}`;
3 changes: 2 additions & 1 deletion packages/suite/src/types/onboarding/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { DeviceModelInternal } from '@trezor/connect';
import { FirmwareVersionString } from '@trezor/device-utils/src/types';

import * as STEP from 'src/constants/onboarding/steps';
import { PrerequisiteType } from 'src/utils/suite/prerequisites';

type ModelWithFirmwareVersion = {
model: DeviceModelInternal;
minFwVersion: `${number}.${number}.${number}`;
minFwVersion: FirmwareVersionString;
};

export type Step = {
Expand Down

0 comments on commit 94a4485

Please sign in to comment.