{"version":3,"file":"helpers.cjs","sourceRoot":"","sources":["../../src/internals/helpers.ts"],"names":[],"mappings":"","sourcesContent":["import type { JsonRpcParams, JsonRpcRequest } from '@metamask/utils';\n\n/**\n * Get the enum values as union type. This allows using both the enum string\n * values and the enum itself as values.\n *\n * Note: This only works for string enums.\n *\n * @example\n * enum Foo {\n *   Bar = 'bar',\n *   Baz = 'baz',\n * }\n *\n * // FooValue is 'bar' | 'baz'\n * type FooValue = EnumToUnion<Foo>;\n *\n * const foo: FooValue = Foo.Bar; // Works\n * const foo: FooValue = 'bar'; // Also works\n * @internal\n */\nexport type EnumToUnion<Type extends string> = `${Type}`;\n\n/**\n * Get a JSON-RPC method with the given name and parameters. If params extends\n * `never`, then the `params` property is omitted.\n *\n * @example\n * // MyMethod is { method: 'my_method', params: { foo: string } }\n * type MyMethod = Method<'my_method', { foo: string }>;\n * @internal\n */\nexport type Method<\n  MethodName extends string,\n  Params extends JsonRpcParams,\n> = Partial<JsonRpcRequest> & Params extends never\n  ? {\n      method: MethodName;\n    }\n  : {\n      method: MethodName;\n      params: Params;\n    };\n"]}