Skip to content

Commit

Permalink
fix: move db ambient types to separate module (#10340)
Browse files Browse the repository at this point in the history
* fix: move ambient types to separate modue

* chore: changeset
  • Loading branch information
bholmesdev authored Mar 6, 2024
1 parent 038201f commit a60861c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-pants-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/db": patch
---

Ensure `astro:db` types exist in your `db/config.ts` before running type generation.
6 changes: 2 additions & 4 deletions packages/db/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export { default, cli } from './dist/index.js';
import './virtual.js';

declare module 'astro:db' {
export { defineTable, defineDB, column, sql, NOW, TRUE, FALSE } from './dist/index.js';
}
export { default, cli } from './dist/index.js';
1 change: 0 additions & 1 deletion packages/db/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export type { ResolvedCollectionConfig, TableConfig } from './core/types.js';
export { cli } from './core/cli/index.js';
export { integration as default } from './core/integration/index.js';
export { sql, NOW, TRUE, FALSE, defineDB, defineTable, column } from './runtime/config.js';
9 changes: 9 additions & 0 deletions packages/db/virtual.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
declare module 'astro:db' {
export const sql: typeof import('./dist/runtime/config.js').sql;
export const NOW: typeof import('./dist/runtime/config.js').NOW;
export const TRUE: typeof import('./dist/runtime/config.js').TRUE;
export const FALSE: typeof import('./dist/runtime/config.js').FALSE;
export const column: typeof import('./dist/runtime/config.js').column;
export const defineDB: typeof import('./dist/runtime/config.js').defineDB;
export const defineTable: typeof import('./dist/runtime/config.js').defineTable;
}

0 comments on commit a60861c

Please sign in to comment.