Skip to content
Open
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
12 changes: 12 additions & 0 deletions .changeset/fix-declaration-emit-exports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@tanstack/db': patch
---

fix: export types used in public API signatures for declaration emit compatibility

Types like `SchemaFromSource`, `MergeContextWithJoinType`, `WithResult`, `ResultTypeFromSelect`, and others
are used in the public method signatures of `BaseQueryBuilder` (e.g. `from()`, `join()`, `select()`) but
were not re-exported from the package's public API. This caused TypeScript error TS2742 when consumers used
`declaration: true` in their tsconfig, as TypeScript could not name the inferred types in generated `.d.ts` files.

Fixes #1012
18 changes: 18 additions & 0 deletions packages/db/src/query/builder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,26 @@ export type QueryResult<T> = GetResult<ExtractContext<T>>
// Export the types from types.ts for convenience
export type {
Context,
ContextSchema,
Source,
GetResult,
RefLeaf as Ref,
InferResultType,
// Types used in public method signatures that must be exported
// for declaration emit to work (see https://github.com/TanStack/db/issues/1012)
SchemaFromSource,
InferCollectionType,
MergeContextWithJoinType,
MergeContextForJoinCallback,
ApplyJoinOptionalityToMergedSchema,
ResultTypeFromSelect,
WithResult,
JoinOnCallback,
RefsForContext,
WhereCallback,
OrderByCallback,
GroupByCallback,
SelectObject,
FunctionalHavingRow,
Prettify,
} from './types.js'
17 changes: 17 additions & 0 deletions packages/db/src/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,28 @@ export {
type InitialQueryBuilder,
type QueryBuilder,
type Context,
type ContextSchema,
type Source,
type GetResult,
type InferResultType,
type ExtractContext,
type QueryResult,
// Types needed for declaration emit (https://github.com/TanStack/db/issues/1012)
type SchemaFromSource,
type InferCollectionType,
type MergeContextWithJoinType,
type MergeContextForJoinCallback,
type ApplyJoinOptionalityToMergedSchema,
type ResultTypeFromSelect,
type WithResult,
type JoinOnCallback,
type RefsForContext,
type WhereCallback,
type OrderByCallback,
type GroupByCallback,
type SelectObject,
type FunctionalHavingRow,
type Prettify,
} from './builder/index.js'

// Expression functions exports
Expand Down
Loading