Skip to content

Commit ee605df

Browse files
committed
fix(types): make ts-types more stronger for Types
1 parent dc6a0c4 commit ee605df

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/types/types.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ export class Types {
1212
endpointType: AllowedTypes;
1313
query: string;
1414
contextId?: string;
15-
}): Promise<{
16-
data: T | null;
17-
error: string | null;
18-
}> {
15+
}): Promise<
16+
| {
17+
data: T;
18+
error: null;
19+
}
20+
| {
21+
data: null;
22+
error: string;
23+
}
24+
> {
1925
const endpoint = `/types/${endpointType}`;
2026
const payload = contextId
2127
? { query: query, context_id: contextId }
@@ -26,7 +32,7 @@ export class Types {
2632
body: payload,
2733
});
2834

29-
if (res.data?.data) return { data: res.data.data, error: null };
35+
if (res.data) return { data: res.data.data, error: null };
3036

3137
return { data: null, error: res.error };
3238
}

0 commit comments

Comments
 (0)