Open
Description
Describe the bug
Correct typings for data returned by entity when {data: "raw"} is provided
ElectroDB Version
3.0.1
Is it possible to do something like:
type GoGetTerminal<
A extends string,
F extends string,
C extends string,
S extends Schema<A, F, C>,
ResponseItem,
> = <Options extends GoQueryTerminalOptions<keyof ResponseItem>>(
options?: Options,
) => Options extends { data: "raw" }
? Promise<{
data: {
$metadata: {
httpStatusCode: number;
requestId: string;
extendedRequestId: string | undefined;
cfId: string | undefined;
attempts: number;
totalRetryDelay: number;
};
Item?: ResponseItem;
};
}>
: Options extends GoQueryTerminalOptions<infer Attr>
? Promise<{
data:
| {
[Name in keyof ResponseItem as Name extends Attr
? Name
: never]: ResponseItem[Name];
}
| null;
}>
: Promise<{ data: ResponseItem | null }>;
Metadata
Assignees
Labels
No labels