diff --git a/src/Typesense/Collections.ts b/src/Typesense/Collections.ts index 0e98f494..e8ea6743 100644 --- a/src/Typesense/Collections.ts +++ b/src/Typesense/Collections.ts @@ -4,7 +4,7 @@ import { CollectionFieldSchema, CollectionSchema } from './Collection' export interface CollectionCreateSchema { name: string default_sorting_field?: string - fields?: CollectionFieldSchema[] + fields: CollectionFieldSchema[] symbols_to_index?: string[] token_separators?: string[] enable_nested_fields?: boolean @@ -19,7 +19,10 @@ const RESOURCEPATH = '/collections' export default class Collections { constructor(private apiCall: ApiCall) {} - async create(schema: CollectionCreateSchema, options: CollectionCreateOptions = {}): Promise { + async create( + schema: TOptions['src_name'] extends string ? Pick : CollectionCreateSchema, + options?: TOptions + ): Promise { return this.apiCall.post(RESOURCEPATH, schema, options) }