@metamask/keyring-utils
Version:
MetaMask Keyring utils
47 lines • 1.65 kB
text/typescript
import { type Infer } from "@metamask/superstruct";
/**
* UUIDv4 struct.
*/
export declare const UuidStruct: import("@metamask/superstruct").Struct<string, null>;
/**
* Account ID (UUIDv4).
*/
export declare const AccountIdStruct: import("@metamask/superstruct").Struct<string, null>;
export type AccountId = Infer<typeof AccountIdStruct>;
/**
* Validates if a given value is a valid URL.
*
* @param value - The value to be validated.
* @returns A boolean indicating if the value is a valid URL.
*/
export declare const UrlStruct: import("@metamask/superstruct").Struct<string, null>;
/**
* A string which contains a positive float number.
*/
export declare const StringNumberStruct: import("@metamask/superstruct").Struct<string, null>;
export type StringNumber = Infer<typeof StringNumberStruct>;
/**
* This is a helper type used by the {@link Equals} type.
*/
type EqualsHelper<Type> = <Dummy>() => Dummy extends Type ? 1 : 2;
/**
* A utility type that checks whether two types are exactly the same.
*
* This type evaluates to `true` if `TypeA` and `TypeB` are identical,
* otherwise it evaluates to `false`.
*
* @template TypeA - The first type to compare.
* @template TypeB - The second type to compare.
*
* @example
* ```ts
* // Example usage:
* type Test1 = Equals<number, number>; // true
* type Test2 = Equals<number, string>; // false
* type Test3 = Equals<{ a: string }, { a: string }>; // true
* type Test4 = Equals<{ a: string }, { a: number }>; // false
* ```
*/
export type Equals<TypeA, TypeB> = EqualsHelper<TypeA> extends EqualsHelper<TypeB> ? true : false;
export {};
//# sourceMappingURL=types.d.mts.map