Skip to content

Commit d43f7d7

Browse files
committed
fix(devframe): add force? param to RpcFunctionsCollector register/update
The RpcFunctionsCollector interface omitted the force? argument that the concrete RpcFunctionsCollectorBase class and its runtime already support. Because the client-side host is typed off the interface (via DevframeClientRpcHost), calling register(fn, true) / update(fn, true) on the client was a type error and required a cast even though it works at runtime. Align the interface with the implementation.
1 parent 46b0ccc commit d43f7d7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/devframe/src/rpc/types.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ export interface RpcFunctionsCollector<LocalFunctions, SetupContext = undefined>
7272
readonly functions: LocalFunctions
7373
/** Map of registered function definitions keyed by function name */
7474
readonly definitions: Map<string, RpcFunctionDefinitionAnyWithContext<SetupContext>>
75-
/** Register a new function definition */
76-
register: (fn: RpcFunctionDefinitionAnyWithContext<SetupContext>) => void
77-
/** Update an existing function definition */
78-
update: (fn: RpcFunctionDefinitionAnyWithContext<SetupContext>) => void
75+
/** Register a new function definition. Pass `force` to overwrite an existing one. */
76+
register: (fn: RpcFunctionDefinitionAnyWithContext<SetupContext>, force?: boolean) => void
77+
/** Update an existing function definition. Pass `force` to register it if it doesn't exist yet. */
78+
update: (fn: RpcFunctionDefinitionAnyWithContext<SetupContext>, force?: boolean) => void
7979
/** Subscribe to function changes, returns unsubscribe function */
8080
onChanged: (fn: (id?: string) => void) => (() => void)
8181
}

0 commit comments

Comments
 (0)