diff --git a/packages/device-utils/src/firmwareUtils.ts b/packages/device-utils/src/firmwareUtils.ts index f595bb6e514..0414905dd33 100644 --- a/packages/device-utils/src/firmwareUtils.ts +++ b/packages/device-utils/src/firmwareUtils.ts @@ -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 || ''; @@ -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 ''; } diff --git a/packages/device-utils/src/types.ts b/packages/device-utils/src/types.ts index 9dc084d4f30..61eb6cda7c2 100644 --- a/packages/device-utils/src/types.ts +++ b/packages/device-utils/src/types.ts @@ -4,3 +4,5 @@ export type PartialDevice = { features?: Device['features']; firmwareType?: Device['firmwareType']; }; + +export type FirmwareVersionString = `${number}.${number}.${number}`; diff --git a/packages/suite/src/types/onboarding/index.ts b/packages/suite/src/types/onboarding/index.ts index af66cc612c4..4a7a5b02730 100644 --- a/packages/suite/src/types/onboarding/index.ts +++ b/packages/suite/src/types/onboarding/index.ts @@ -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 = {