File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import type { JSONValue } from '../types' ;
2-
3- // eslint-disable-next-line
4- type NoData = { } ;
1+ import type { JSONValue , ObjectEmpty } from '../types' ;
52
63// Prevent overwriting the metadata type with `Omit<>`
7- type AgentRPCRequestParams < T extends Record < string , JSONValue > = NoData > = {
8- metadata ?: {
9- [ Key : string ] : JSONValue ;
10- } & Partial < {
11- authorization : string ;
12- timeout : number ;
13- } > ;
14- } & Omit < T , 'metadata' > ;
4+ type AgentRPCRequestParams < T extends Record < string , JSONValue > = ObjectEmpty > =
5+ {
6+ metadata ?: {
7+ [ Key : string ] : JSONValue ;
8+ } & Partial < {
9+ authorization : string ;
10+ timeout : number ;
11+ } > ;
12+ } & Omit < T , 'metadata' > ;
1513
1614// Prevent overwriting the metadata type with `Omit<>`
17- type AgentRPCResponseResult < T extends Record < string , JSONValue > = NoData > = {
18- metadata ?: {
19- [ Key : string ] : JSONValue ;
20- } & Partial < {
21- authorization : string ;
22- timeout : number ;
23- } > ;
24- } & Omit < T , 'metadata' > ;
15+ type AgentRPCResponseResult < T extends Record < string , JSONValue > = ObjectEmpty > =
16+ {
17+ metadata ?: {
18+ [ Key : string ] : JSONValue ;
19+ } & Partial < {
20+ authorization : string ;
21+ timeout : number ;
22+ } > ;
23+ } & Omit < T , 'metadata' > ;
2524
26- export type { AgentRPCRequestParams , AgentRPCResponseResult , NoData } ;
25+ export type { AgentRPCRequestParams , AgentRPCResponseResult } ;
Original file line number Diff line number Diff line change 1- import type { JSONValue } from '../types' ;
2-
3- // eslint-disable-next-line
4- type NoData = { } ;
1+ import type { JSONValue , ObjectEmpty } from '../types' ;
52
63// Prevent overwriting the metadata type with `Omit<>`
7- type ClientRPCRequestParams < T extends Record < string , JSONValue > = NoData > = {
8- metadata ?: {
9- [ Key : string ] : JSONValue ;
10- } & Partial < {
11- authorization : string ;
12- timeout : number ;
13- } > ;
14- } & Omit < T , 'metadata' > ;
4+ type ClientRPCRequestParams < T extends Record < string , JSONValue > = ObjectEmpty > =
5+ {
6+ metadata ?: {
7+ [ Key : string ] : JSONValue ;
8+ } & Partial < {
9+ authorization : string ;
10+ timeout : number ;
11+ } > ;
12+ } & Omit < T , 'metadata' > ;
1513
1614// Prevent overwriting the metadata type with `Omit<>`
17- type ClientRPCResponseResult < T extends Record < string , JSONValue > = NoData > = {
15+ type ClientRPCResponseResult <
16+ T extends Record < string , JSONValue > = ObjectEmpty ,
17+ > = {
1818 metadata ?: {
1919 [ Key : string ] : JSONValue ;
2020 } & Partial < {
@@ -23,4 +23,4 @@ type ClientRPCResponseResult<T extends Record<string, JSONValue> = NoData> = {
2323 } > ;
2424} & Omit < T , 'metadata' > ;
2525
26- export type { ClientRPCRequestParams , ClientRPCResponseResult , NoData } ;
26+ export type { ClientRPCRequestParams , ClientRPCResponseResult } ;
Original file line number Diff line number Diff line change @@ -151,6 +151,13 @@ type InverseRecord<
151151 [ K in M [ keyof M ] ] : RecordKeyFromValue < M , K > ;
152152} ;
153153
154+ /**
155+ * Used when an empty object is needed.
156+ * Defined here with a linter override to avoid a false positive.
157+ */
158+ // eslint-disable-next-line
159+ type ObjectEmpty = { } ;
160+
154161export type {
155162 POJO ,
156163 JSONValue ,
@@ -171,4 +178,5 @@ export type {
171178 NonFunctionProperties ,
172179 RecordKeyFromValue ,
173180 InverseRecord ,
181+ ObjectEmpty ,
174182} ;
You can’t perform that action at this time.
0 commit comments