Conversation
CollectionUpdateSchema explicitly lists synonym_sets but is missing curation_sets, even though BaseCollectionCreateSchema already defines it. This causes consumers to extend the interface locally or use type assertions when calling collection.update() with curation_sets.
CurationSetItem.upsert() currently requires CurationObjectSchema which includes id as a required field. Since the item id is already part of the URL path (PUT /curation_sets/:name/items/:id), the request body should not require it. Introduce CurationItemUpsertSchema as Omit<CurationObjectSchema, "id"> and use it as the parameter type for upsert(), aligning the SDK with the actual Typesense v30 API contract.
src/Typesense/Collection.ts
Outdated
| extends Partial<Omit<CollectionCreateSchema, "name" | "fields">> { | ||
| fields?: (CollectionFieldSchema | CollectionDropFieldSchema)[]; | ||
| synonym_sets?: string[]; | ||
| curation_sets?: string[]; |
There was a problem hiding this comment.
CollectionUpdateSchema already picks this up transitively via Partial<Omit<CollectionCreateSchema, "name" | "fields">>, because CollectionCreateSchema is based on BaseCollectionCreateSchema, which already includes curation_sets. So adding curation_sets directly on CollectionUpdateSchema is redundant.
TypeScript interface declaration merging means redeclaring the same property here won’t necessarily break anything, but it still doesn’t add new type information and makes the schema definition harder to reason about.
There was a problem hiding this comment.
I think I should have double checked the types. Looking back synonym_sets also seems redundant here.
Should I remove that as well from the extended type or leave it for now and just remove the update I have done?
There was a problem hiding this comment.
If you could remove it, I would appreciate it. It doesn't hurt being here, but removing it cleans redundant declarations!
There was a problem hiding this comment.
Got it, I have removed the redundant types and pushed the changes
There was a problem hiding this comment.
@tharropoulos LMK if you need any more changes to be done on the PR or if it's okay to be merged
…hema synonym_sets and curation_sets are already inherited via Partial<Omit<CollectionCreateSchema, "name" | "fields">>.
Change Summary
Fix two missing type definitions for curation set support in Typesense v30:
CollectionUpdateSchema missing curation_sets —
synonym_setswas explicitlyadded but
curation_setswas not, even thoughBaseCollectionCreateSchemaalreadydefines both. This forces consumers to extend the interface locally to call
collection.update({ curation_sets: [...] }). Thehttps://typesense.org/docs/30.0/api/curation.html confirm
curation_setsissupported on collection PATCH.
CurationSetItem.upsert() requires id in the body — The upsert endpoint is PUT
/curation_sets/:name/items/:id, so id lives in the URL path. But the methodrequires
CurationObjectSchemawhich has id as mandatory, forcing as unknown ascasts. Introduced
CurationItemUpsertSchema (Omit<CurationObjectSchema, "id">)toalign the SDK with the https://typesense.org/docs/30.0/api/curation.html.
PR Checklist
Change Summary