mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-02 21:45:14 +01:00
chore(utils): typedObjectKeys
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
getSynchronize,
|
||||
isNotUndefined,
|
||||
resolveAfter,
|
||||
typedObjectKeys,
|
||||
} from '@trezor/utils';
|
||||
|
||||
import { ERRORS } from '../constants';
|
||||
@@ -26,7 +27,6 @@ import { DEVICE, TransportError, TransportInfo } from '../events';
|
||||
import { Device } from './Device';
|
||||
import { getBridgeInfo } from '../data/transportInfo';
|
||||
import { ConnectSettings, DeviceUniquePath, StaticSessionId } from '../types';
|
||||
import { typedObjectKeys } from '../types/utils';
|
||||
import { initLog } from '../utils/debug';
|
||||
|
||||
const createAuthPenaltyManager = (priority: number) => {
|
||||
|
||||
@@ -18,6 +18,3 @@ export type MessageFactoryFn<Group, Event> = UnionToIntersection<
|
||||
) => { event: Group; type: Event['type']; payload: undefined }
|
||||
: never
|
||||
>;
|
||||
|
||||
export const typedObjectKeys = <T extends Record<any, any>>(obj: T): Array<keyof T> =>
|
||||
Object.keys(obj) as Array<keyof T>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
import { TimerId } from '@trezor/type-utils';
|
||||
import { Deferred, TypedEmitter, createDeferred } from '@trezor/utils';
|
||||
import { Deferred, TypedEmitter, createDeferred, typedObjectKeys } from '@trezor/utils';
|
||||
|
||||
import type {
|
||||
AcquireDoneRequest,
|
||||
@@ -27,10 +27,6 @@ import * as ERRORS from '../errors';
|
||||
import type { Descriptor, PathInternal, Success } from '../types';
|
||||
import { PathPublic, Session } from '../types';
|
||||
|
||||
function typedObjectKeys<T extends Record<any, any>>(obj: T): Array<keyof T> {
|
||||
return Object.keys(obj) as Array<keyof T>;
|
||||
}
|
||||
|
||||
type DescriptorsDict = Record<PathInternal, Descriptor>;
|
||||
|
||||
// in nodeusb, enumeration operation takes ~3 seconds
|
||||
|
||||
@@ -51,5 +51,6 @@ export * from './throttler';
|
||||
export * from './throwError';
|
||||
export * from './topologicalSort';
|
||||
export * from './typedEventEmitter';
|
||||
export * from './typedObjectKeys';
|
||||
export * from './urlToOnion';
|
||||
export * from './zip';
|
||||
|
||||
2
packages/utils/src/typedObjectKeys.ts
Normal file
2
packages/utils/src/typedObjectKeys.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export const typedObjectKeys = <T extends Record<any, any>>(obj: T): Array<keyof T> =>
|
||||
Object.keys(obj) as Array<keyof T>;
|
||||
Reference in New Issue
Block a user