import type PocketBase from 'pocketbase' import type { RecordService, SendOptions } from 'pocketbase' // This file was @generated using pocketbase-typegen import type { CollectionResponses } from './pb-types'; // Generate union type of comma-separated keys type Join = K extends string ? `${K}${D}${Join, D>}` | K : never; type FieldCombinations = Join, ','>; type ParseFields = S extends `${infer F},${infer Rest}` ? F | ParseFields : S; type PickFields = { [P in K]: T[P]; }; interface CommonOptions extends SendOptions { fields?: K; } interface RecordOptions extends CommonOptions { expand?: string; } interface MyRecordService extends RecordService { getOne< F extends FieldCombinations, Keys = ParseFields extends keyof M ? ParseFields : keyof M, R = PickFields> >( id: string, options?: RecordOptions | undefined ): Promise; } // Type for usage with type asserted PocketBase instance // https://github.com/pocketbase/js-sdk#specify-typescript-definitions export interface TPocketBase extends PocketBase { collection(idOrName: Name): MyRecordService }