@ocap/types
Version:
Typescript definitions generated from protobuf
39 lines (30 loc) • 1.16 kB
text/typescript
// core/types/interfaces/base.ts
import type BaseBN from 'bn.js';
// BN type definition - implementation is in @ocap/util
export interface BN extends BaseBN {}
export type { BaseBN };
export type Promisable<T> = T | Promise<T>;
export type BytesType = string | Buffer | Uint8Array;
export type Timestamp = string | number | Date;
export type Address = string;
export type Hash = string;
export interface IAny {
typeUrl: string;
value: Uint8Array;
}
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};
/**
* Make specific keys required (keeps all other fields, makes K required and non-nullable)
* Useful for pipeline context types where certain fields become guaranteed after specific phases
*/
export type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;
/**
* Make all properties in T non-nullable (remove undefined from each property)
*/
export type NonNullableFields<T> = {
[P in keyof T]: NonNullable<T[P]>;
};