From e4a6a7d778ade6c3893b14ba04a39dad567b0308 Mon Sep 17 00:00:00 2001 From: Travis Frank Date: Tue, 14 Jun 2022 17:42:48 +0200 Subject: [PATCH] types: Refine types on HyperStub --- package.json | 2 +- src/HyperNamespaceProxy.ts | 8 ++++---- src/index.d.ts | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 74d5c4c..f289757 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ticketbridge/hyper-durable", - "version": "0.1.11", + "version": "0.1.12", "description": "Object-like access to Durable Object properties and methods", "repository": { "type": "git", diff --git a/src/HyperNamespaceProxy.ts b/src/HyperNamespaceProxy.ts index b9a9d5e..31ec782 100644 --- a/src/HyperNamespaceProxy.ts +++ b/src/HyperNamespaceProxy.ts @@ -42,14 +42,14 @@ export class HyperNamespaceProxy, ENV> impleme // fetch interface. type PromisedGetStub = { [Prop in keyof DO]?: - DO[Prop] extends Function - ? () => Promise - : Promise; + DO[Prop] extends (...args: any) => any + ? (...args: Parameters) => Promise> + : Promise; }; // All of our props have setters formatted as: setProperty() type SetStub = { [Prop in keyof DO as DO[Prop] extends Function ? never : `set${Capitalize}`]?: - (newValue: DO[Prop]) => Promise + (newValue: DO[Prop]) => Promise } type HyperStub = DurableObjectStub & PromisedGetStub & SetStub; diff --git a/src/index.d.ts b/src/index.d.ts index 3d296a5..555bd44 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -40,12 +40,12 @@ export class HyperNamespaceProxy, Env> { ); get(id: DurableObjectId): DurableObjectStub & { [Prop in keyof DO]: - DO[Prop] extends Function - ? () => Promise - : Promise; + DO[Prop] extends (...args: any) => any + ? (...args: Parameters) => Promise> + : Promise; } & { [Prop in keyof DO as DO[Prop] extends Function ? never : `set${Capitalize}`]: - (newValue: DO[Prop]) => Promise + (newValue: DO[Prop]) => Promise }; }