summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2024-03-06 08:30:45 -0500
committerGravatar GitHub <noreply@github.com> 2024-03-06 08:30:45 -0500
commita60861c960bf3d24af9b2784b5b333855c968731 (patch)
treeee6cd8abf720e76cf51b2fcafd087c62e8e2beb2
parent038201fbaea9a4c040d50df5d90d83b27d3dbc76 (diff)
downloadastro-a60861c960bf3d24af9b2784b5b333855c968731.tar.gz
astro-a60861c960bf3d24af9b2784b5b333855c968731.tar.zst
astro-a60861c960bf3d24af9b2784b5b333855c968731.zip
fix: move db ambient types to separate module (#10340)
* fix: move ambient types to separate modue * chore: changeset
-rw-r--r--.changeset/dry-pants-act.md5
-rw-r--r--packages/db/index.d.ts6
-rw-r--r--packages/db/src/index.ts1
-rw-r--r--packages/db/virtual.d.ts9
4 files changed, 16 insertions, 5 deletions
diff --git a/.changeset/dry-pants-act.md b/.changeset/dry-pants-act.md
new file mode 100644
index 000000000..a6279685a
--- /dev/null
+++ b/.changeset/dry-pants-act.md
@@ -0,0 +1,5 @@
+---
+"@astrojs/db": patch
+---
+
+Ensure `astro:db` types exist in your `db/config.ts` before running type generation.
diff --git a/packages/db/index.d.ts b/packages/db/index.d.ts
index 81af4fb43..7c0e055b2 100644
--- a/packages/db/index.d.ts
+++ b/packages/db/index.d.ts
@@ -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';
diff --git a/packages/db/src/index.ts b/packages/db/src/index.ts
index 0073f2b33..a27543376 100644
--- a/packages/db/src/index.ts
+++ b/packages/db/src/index.ts
@@ -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';
diff --git a/packages/db/virtual.d.ts b/packages/db/virtual.d.ts
new file mode 100644
index 000000000..57398d6e6
--- /dev/null
+++ b/packages/db/virtual.d.ts
@@ -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;
+}