import { BaseCloudflare, ClientOptions } from "./client.js";
import { APIResource } from "./core/resource.js";
export type PartialCloudflare<T extends MaybeResource> = BaseCloudflare & T;
type InferClientStructure<T extends readonly (typeof APIResource)[]> = SimplifyResources<UnionToIntersection<ResourcePath<T[number]>>> extends infer O extends MaybeResource ? O : never;
/**
 * Creates a client with a subset of the available resources to reduce
 * bundle size.
 * Import the resource classes you need from `cloudflare/resources/*`.
 * Use the BaseResource variants if you do not need to use subresources.
 *
 * @example
 * ```ts
 * import { Accounts } from `cloudflare/resources/accounts`;
 * import { createClient } from `cloudflare/tree-shakable`;
 *
 * const client = createClient({
 *   resources: [Accounts],
 * });
 * ```
 */
export declare function createClient<const T extends readonly (typeof APIResource)[]>(options: ClientOptions & {
    resources: T;
}): PartialCloudflare<InferClientStructure<T>>;
/**
 * `FromDeepEntry<['a', 'b', 'c'], 'value'>` -> `{ a: { b: { c: 'value'; }; }; }`
 */
type FromDeepEntry<K extends readonly PropertyKey[], V> = K['length'] extends 1 ? {
    [_ in K[0]]: V;
} & {} : K extends readonly [infer First extends PropertyKey, ...infer Rest extends readonly PropertyKey[]] ? {
    [_ in First]: FromDeepEntry<Rest, V>;
} : never;
/**
 * `ResourcePath<{ _key: ["a", "b", "c"]; new (): Instance }>` -> `{ a: { b: { c: Instance; }; }; }`
 */
type ResourcePath<T extends typeof APIResource> = T extends any ? FromDeepEntry<T['_key'], InstanceType<T>> : never;
/**
 * `UnionToIntersection<{ a: 1 } | { b: 2 }>` -> `{ a: 1 } & { b: 2 }`
 */
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
/**
 * Makes the types look nicer:
 * `SimplifyResources<{ a: APIResource } & { b: { c: APIResource } & { d: APIResource } }>` -> `{ a: APIResource; b: { c: APIResource; d: APIResource; }; }`
 */
type SimplifyResources<T> = T extends APIResource ? T : T extends object ? {
    [P in keyof T as string extends P ? never : P]: SimplifyResources<T[P]>;
} : T;
type MaybeResource = MaybeResource_ | APIResource;
interface MaybeResource_ {
    [_: string]: MaybeResource;
}
export {};
//# sourceMappingURL=tree-shakable.d.ts.map