Skip to content
Closed
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/fix-table-core-dts-module-scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/table-core': patch
---

fix(table-core): export RangeValue and ensure emitted declaration files preserve module scope
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { constructAggregationFn } from './rowAggregationFeature.types'

type RangeValue = Date | number
export type RangeValue = Date | number

function isNumber(value: unknown): value is number {
return typeof value === 'number'
Expand Down
12 changes: 12 additions & 0 deletions scripts/rewrite-table-core-dts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,22 @@ function rewriteDeclaration(source, file) {
next = next.replaceAll('Column_Internal', 'Column')

next = ensurePublicTypeImports(next, file)
next = ensureModuleScope(next)

return next
}

function ensureModuleScope(source) {
if (
!/\bexport\s*(?:\{|\*|default|type|interface|function|class|const|let|var|enum)\b/.test(
source,
)
) {
return `${source.trimEnd()}\n\nexport {};\n`
}
return source
}

const files = walkDeclarationFiles(distDir)

for (const file of files) {
Expand Down