Skip to content

Commit a935ec2

Browse files
committed
feat: default type to query
1 parent 456a6cb commit a935ec2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export type EntriesToObject<T extends readonly [string, any][]> = {
1212
* - action: A function that performs an action (no data returned)
1313
* - event: A function that emits an event (no data returned), and does not wait for a response
1414
* - query: A function that queries a resource
15+
*
16+
* By default, the function is a query function.
1517
*/
1618
export type RpcFunctionType = 'static' | 'action' | 'event' | 'query'
1719

@@ -35,13 +37,13 @@ export interface RpcFunctionSetupResult<
3537

3638
export interface RpcFunctionDefinition<
3739
NAME extends string,
38-
TYPE extends RpcFunctionType,
40+
TYPE extends RpcFunctionType = 'query',
3941
ARGS extends any[] = [],
4042
RETURN = void,
4143
CONTEXT = undefined,
4244
> {
4345
name: NAME
44-
type: TYPE
46+
type?: TYPE
4547
setup?: (context: CONTEXT) => Thenable<RpcFunctionSetupResult<ARGS, RETURN>>
4648
handler?: (...args: ARGS) => RETURN
4749
__resolved?: RpcFunctionSetupResult<ARGS, RETURN>

0 commit comments

Comments
 (0)