From 2b0853cfe3fe17137497a25e428bd42e47a14349 Mon Sep 17 00:00:00 2001 From: Brainslug Date: Mon, 28 Jul 2025 15:53:00 +0200 Subject: [PATCH 1/5] starter breaking change not for typed services --- .../3.breaking-changes/2.version-11.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/content/releases/3.breaking-changes/2.version-11.md b/content/releases/3.breaking-changes/2.version-11.md index b0f4d1f4..b4072de6 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.9.4 + +#### Typed services for API extensions using TypeScript + +The services exposed to API extensions using TypeScript are now fully typed instead of `any` this can potentially 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 were accepted before: +- The ItemsService constructor now expects the collection name to be a `string` so this will error on `string | undefined` (or other unions). +- Similarly functions like `service.readOne()`/`service.readMany()` now expects `string | number` for their primary keys and will error for nullable types + +::callout{icon="material-symbols:info-outline"} +**Workaround** + :::collapsible{name="type workarounds"} + When running into type errors casting the services to `any` will result in the old 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 From 736327414a5fdde9cf5bc0011012be4d0c14d9a9 Mon Sep 17 00:00:00 2001 From: Brainslug Date: Mon, 28 Jul 2025 16:29:45 +0200 Subject: [PATCH 2/5] fixed version --- content/releases/3.breaking-changes/2.version-11.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/releases/3.breaking-changes/2.version-11.md b/content/releases/3.breaking-changes/2.version-11.md index b4072de6..e2792fc2 100644 --- a/content/releases/3.breaking-changes/2.version-11.md +++ b/content/releases/3.breaking-changes/2.version-11.md @@ -3,7 +3,7 @@ title: Version 11 description: Breaking changes may require action on your part before upgrading. --- -## Version 11.9.4 +## Version 11.10.0 #### Typed services for API extensions using TypeScript From ba106cf413814a09a0904b76888506480209b2be Mon Sep 17 00:00:00 2001 From: Brainslug Date: Mon, 28 Jul 2025 17:26:54 +0200 Subject: [PATCH 3/5] slight wording change --- content/releases/3.breaking-changes/2.version-11.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/releases/3.breaking-changes/2.version-11.md b/content/releases/3.breaking-changes/2.version-11.md index e2792fc2..2603981a 100644 --- a/content/releases/3.breaking-changes/2.version-11.md +++ b/content/releases/3.breaking-changes/2.version-11.md @@ -9,7 +9,7 @@ description: Breaking changes may require action on your part before upgrading. The services exposed to API extensions using TypeScript are now fully typed instead of `any` this can potentially 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 were accepted before: +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` so this will error on `string | undefined` (or other unions). - Similarly functions like `service.readOne()`/`service.readMany()` now expects `string | number` for their primary keys and will error for nullable types From 2145f9bc1955b07d77f5ea453027722ae92e49bf Mon Sep 17 00:00:00 2001 From: Brainslug Date: Mon, 28 Jul 2025 18:09:23 +0200 Subject: [PATCH 4/5] Update content/releases/3.breaking-changes/2.version-11.md Co-authored-by: daedalus <44623501+ComfortablyCoding@users.noreply.github.com> --- content/releases/3.breaking-changes/2.version-11.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/releases/3.breaking-changes/2.version-11.md b/content/releases/3.breaking-changes/2.version-11.md index 2603981a..489af620 100644 --- a/content/releases/3.breaking-changes/2.version-11.md +++ b/content/releases/3.breaking-changes/2.version-11.md @@ -7,11 +7,11 @@ description: Breaking changes may require action on your part before upgrading. #### Typed services for API extensions using TypeScript -The services exposed to API extensions using TypeScript are now fully typed instead of `any` this can potentially cause new type errors when building extensions. +The services exposed to API extensions using TypeScript are now fully typed instead of `any`, this 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` so this will error on `string | undefined` (or other unions). -- Similarly functions like `service.readOne()`/`service.readMany()` now expects `string | number` for their primary keys and will error for nullable types +- 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** From 40bd5e8d17c74eba77be75ec14a74173bed35fe8 Mon Sep 17 00:00:00 2001 From: Brainslug Date: Mon, 28 Jul 2025 19:07:39 +0200 Subject: [PATCH 5/5] Update content/releases/3.breaking-changes/2.version-11.md Co-authored-by: ian --- content/releases/3.breaking-changes/2.version-11.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/releases/3.breaking-changes/2.version-11.md b/content/releases/3.breaking-changes/2.version-11.md index 489af620..87ea4bf4 100644 --- a/content/releases/3.breaking-changes/2.version-11.md +++ b/content/releases/3.breaking-changes/2.version-11.md @@ -7,16 +7,16 @@ description: Breaking changes may require action on your part before upgrading. #### Typed services for API extensions using TypeScript -The services exposed to API extensions using TypeScript are now fully typed instead of `any`, this may cause new type errors when building extensions. +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: +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 +- 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"} - When running into type errors casting the services to `any` will result in the old behavior. + If you encounter type errors, you can cast the services to `any` to restore the previous behavior: ```ts export default defineHook(({ filter, action }, context) => {