Skip to content

Commit

Permalink
types: Fix D1 run() type (#2422)
Browse files Browse the repository at this point in the history
* types: Fix D1 run() type

This is out of sync with prod, which is does accept a type parameter and returns a `D1Result`

* [D1] Update tests for .run() types to match the current state

---------

Co-authored-by: Max Rozen <[email protected]>
  • Loading branch information
elithrar and rozenmd committed Jul 23, 2024
1 parent d1fbad2 commit d1b6269
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion types/defines/d1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare abstract class D1PreparedStatement {
bind(...values: unknown[]): D1PreparedStatement;
first<T = unknown>(colName: string): Promise<T | null>;
first<T = Record<string, unknown>>(): Promise<T | null>;
run(): Promise<D1Response>;
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
raw<T = unknown[]>(options: {columnNames: true}): Promise<[string[], ...T[]]>;
raw<T = unknown[]>(options?: {columnNames?: false}): Promise<T[]>;
Expand Down
2 changes: 1 addition & 1 deletion types/test/types/d1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const handler: ExportedHandler<{ DB: D1Database }> = {
expectType<{
meta: Record<string, unknown>;
success: boolean;
results?: never;
results?: any;
}>(response);
}

Expand Down

0 comments on commit d1b6269

Please sign in to comment.