@@ -2,8 +2,8 @@ import type {
22 D1Database ,
33 D1PreparedStatement as RawStatement ,
44} from "@cloudflare/workers-types" ;
5- import type { Connector } from "db0" ;
6- import { BoundableStatement } from "./_internal/statement" ;
5+ import type { Connector , Primitive } from "db0" ;
6+ import { BoundableStatement } from "./_internal/statement.ts " ;
77
88export interface ConnectorOptions {
99 bindingName ?: string ;
@@ -15,8 +15,8 @@ export default function cloudflareD1Connector(
1515 const getDB = ( ) => {
1616 // TODO: Remove legacy __cf_env__ support in next major version
1717 const binding : D1Database =
18- globalThis . __env__ ?. [ options . bindingName ] ||
19- globalThis . __cf_env__ ?. [ options . bindingName ] ;
18+ ( ( globalThis as any ) . __env__ as any ) ?. [ options . bindingName ! ] ||
19+ ( ( globalThis as any ) . __cf_env__ as any ) ?. [ options . bindingName ! ] ;
2020 if ( ! binding ) {
2121 throw new Error (
2222 `[db0] [d1] binding \`${ options . bindingName } \` not found` ,
@@ -35,17 +35,17 @@ export default function cloudflareD1Connector(
3535}
3636
3737class StatementWrapper extends BoundableStatement < RawStatement > {
38- async all ( ...params ) {
38+ async all ( ...params : Primitive [ ] ) {
3939 const res = await this . _statement . bind ( ...params ) . all ( ) ;
4040 return res . results ;
4141 }
4242
43- async run ( ...params ) {
43+ async run ( ...params : Primitive [ ] ) {
4444 const res = await this . _statement . bind ( ...params ) . run ( ) ;
4545 return res ;
4646 }
4747
48- async get ( ...params ) {
48+ async get ( ...params : Primitive [ ] ) {
4949 const res = await this . _statement . bind ( ...params ) . first ( ) ;
5050 return res ;
5151 }
0 commit comments