From 9ae8604a2263cfc56f38f03fd01b48bc87591bff Mon Sep 17 00:00:00 2001 From: Fanis Tharropoulos Date: Tue, 25 Feb 2025 13:47:28 +0200 Subject: [PATCH] fix(types): correct type reference in CollectionFieldSchema - Change `CollectionFieldSchema` to extend properties from `BaseCollectionCreateSchema` instead of `CollectionCreateSchema` - Export `BaseCollectionCreateSchema` interface to make it accessible - Fix imports in Collection.ts to use the correct types --- src/Typesense/Collection.ts | 8 ++++++-- src/Typesense/Collections.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Typesense/Collection.ts b/src/Typesense/Collection.ts index b8bb7747..024bbce8 100644 --- a/src/Typesense/Collection.ts +++ b/src/Typesense/Collection.ts @@ -1,5 +1,9 @@ import ApiCall from "./ApiCall"; -import Collections, { CollectionCreateSchema } from "./Collections"; +import Collections from "./Collections"; +import type { + BaseCollectionCreateSchema, + CollectionCreateSchema, +} from "./Collections"; import Documents, { DocumentSchema } from "./Documents"; import { ObjectNotFound } from "./Errors"; import Overrides from "./Overrides"; @@ -30,7 +34,7 @@ export type FieldType = export interface CollectionFieldSchema extends Partial< - Pick + Pick > { name: string; type: FieldType; diff --git a/src/Typesense/Collections.ts b/src/Typesense/Collections.ts index c3cd29cb..9cfcee2b 100644 --- a/src/Typesense/Collections.ts +++ b/src/Typesense/Collections.ts @@ -1,7 +1,7 @@ import ApiCall from "./ApiCall"; import type { CollectionFieldSchema, CollectionSchema } from "./Collection"; -interface BaseCollectionCreateSchema { +export interface BaseCollectionCreateSchema { name: string; default_sorting_field?: string; symbols_to_index?: string[];