diff --git a/.changeset/warm-hoops-allow.md b/.changeset/warm-hoops-allow.md new file mode 100644 index 00000000000..74cc56b262f --- /dev/null +++ b/.changeset/warm-hoops-allow.md @@ -0,0 +1,5 @@ +--- +"@effect/platform": minor +--- + +The type of the HttpApi groups and endpoints are correctly inferred. diff --git a/packages/platform/src/HttpApi.ts b/packages/platform/src/HttpApi.ts index 2cbcf250648..d137f17222a 100644 --- a/packages/platform/src/HttpApi.ts +++ b/packages/platform/src/HttpApi.ts @@ -52,7 +52,9 @@ export interface HttpApi< new(_: never): {} readonly [TypeId]: TypeId readonly identifier: Id - readonly groups: Record.ReadonlyRecord + readonly groups: { + readonly [K in HttpApiGroup.HttpApiGroup.Name]: HttpApiGroup.HttpApiGroup.WithName + } readonly annotations: Context.Context readonly errorSchema: Schema.Schema readonly middlewares: ReadonlySet diff --git a/packages/platform/src/HttpApiGroup.ts b/packages/platform/src/HttpApiGroup.ts index 60877abb79e..cb9215765ce 100644 --- a/packages/platform/src/HttpApiGroup.ts +++ b/packages/platform/src/HttpApiGroup.ts @@ -49,7 +49,9 @@ export interface HttpApiGroup< readonly [TypeId]: TypeId readonly identifier: Id readonly topLevel: TopLevel - readonly endpoints: Record.ReadonlyRecord + readonly endpoints: { + readonly [K in HttpApiEndpoint.HttpApiEndpoint.Name]: HttpApiEndpoint.HttpApiEndpoint.WithName + } readonly errorSchema: Schema.Schema readonly annotations: Context.Context readonly middlewares: ReadonlySet