Skip to content

Commit 1054068

Browse files
committed
fix(drizzle): add missing closing parenthesis in D1 getDb function
When generating the database client file for Cloudflare D1, the template string was missing a closing parenthesis in the arrow function parameter, resulting in invalid TypeScript syntax. This caused the parser to fail with 'Unexpected token' error during project creation when using the drizzle addon with D1 database option. Changed: export const getDb = (d1: D1Database => drizzle(d1, { schema }); To: export const getDb = (d1: D1Database) => drizzle(d1, { schema }); Fixes the error: Unable to process 'src/lib/server/db/index.ts'. Reason: Unexpected token
1 parent 490859d commit 1054068

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/sv/src/addons/drizzle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export default defineAddon({
350350
js.imports.addNamed(ast, { from: 'drizzle-orm/d1', imports: ['drizzle'] });
351351

352352
const getDbFn = js.common.parseStatement(
353-
`export const getDb = (d1${ts(': D1Database')} => drizzle(d1, { schema });`
353+
`export const getDb = (d1${ts(': D1Database')}) => drizzle(d1, { schema });`
354354
);
355355

356356
ast.body.push(getDbFn);

0 commit comments

Comments
 (0)