From ba059af7be5c6e4dc31243794f3c018b2ab240f2 Mon Sep 17 00:00:00 2001 From: Travis Frank Date: Wed, 15 Jun 2022 17:42:47 +0200 Subject: [PATCH] types: Improve types on proxyHyperDurables --- package.json | 2 +- src/index.d.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0fd7b97..bf5e124 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ticketbridge/hyper-durable", - "version": "0.1.15", + "version": "0.1.16", "description": "Object-like access to Durable Object properties and methods", "repository": { "type": "git", diff --git a/src/index.d.ts b/src/index.d.ts index 583f154..c21d707 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -56,9 +56,10 @@ export class HyperNamespaceProxy, Env> { get(id: DurableObjectId): HyperStub; } -export function proxyHyperDurables, Env>( +// TODO: Don't rely on undocumented behavior +export function proxyHyperDurables, Env, K extends string, DO extends HyperDurable>( env: Env, - doBindings: { [key: string]: new (state: DurableObjectState, env: Env) => DO } + doBindings: Bindings ): { - [Prop in keyof typeof doBindings]: HyperNamespaceProxy + [Prop in keyof Bindings]: HyperNamespaceProxy }