From 6f693d5608465c6108f8489b6ab1a9b6da6c1320 Mon Sep 17 00:00:00 2001 From: VastBlast <48421698+VastBlast@users.noreply.github.com> Date: Fri, 13 Feb 2026 16:36:56 -0500 Subject: [PATCH] fix(types): add callback contextual typing (#134) --- src/types.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/types.d.ts b/src/types.d.ts index c5bf876..ee9196a 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -108,7 +108,9 @@ export type Stubify = // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`. // prettier-ignore type UnstubifyInner = - T extends StubBase ? (T | V) // can provide either stub or local RpcTarget + // Keep local RpcTarget acceptance, but avoid `Stub | Value` unions when the stub + // is already assignable to the value type (needed for callback contextual typing). + T extends StubBase ? (T extends V ? V : (T | V)) : T extends Map ? Map, Unstubify> : T extends Set ? Set> : T extends [] ? []