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 [] ? []