Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move db ambient types to separate module #10340

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading