diff --git a/content/releases/3.breaking-changes/2.version-11.md b/content/releases/3.breaking-changes/2.version-11.md index b0f4d1f4..87ea4bf4 100644 --- a/content/releases/3.breaking-changes/2.version-11.md +++ b/content/releases/3.breaking-changes/2.version-11.md @@ -3,6 +3,32 @@ title: Version 11 description: Breaking changes may require action on your part before upgrading. --- +## Version 11.10.0 + +#### Typed services for API extensions using TypeScript + +The services exposed to API extensions using TypeScript are now fully typed instead of `any`, which may cause new type errors when building extensions. + +Arguments of service methods are now strictly typed, which can result in type errors for broader types that would not error before: +- The ItemsService constructor now expects the collection name to be a `string` and will error on `string | undefined` (or other unions). +- Similarly, functions like `service.readOne()`/`service.readMany()` now expect `string | number` for their primary keys and will error for nullable types + +::callout{icon="material-symbols:info-outline"} +**Workaround** + :::collapsible{name="type workarounds"} + If you encounter type errors, you can cast the services to `any` to restore the previous behavior: + + ```ts + export default defineHook(({ filter, action }, context) => { + const { services, database: knex, getSchema, logger } = context; + const { ItemsService, FieldsService } = services as any; + + ... + }); + ``` + ::: +:: + ## Version 11.9.0 #### SDK login function now uses a payload parameter for email and password