Skip to content

fix: use namespace instead of module keyword for TS 6/7 compat#2249

Merged
dfahlander merged 1 commit intodexie:masterfrom
steven-pribilinskiy:fix/ts7-module-to-namespace
Feb 26, 2026
Merged

fix: use namespace instead of module keyword for TS 6/7 compat#2249
dfahlander merged 1 commit intodexie:masterfrom
steven-pribilinskiy:fix/ts7-module-to-namespace

Conversation

@steven-pribilinskiy
Copy link
Contributor

@steven-pribilinskiy steven-pribilinskiy commented Feb 24, 2026

Summary

Fixes #2248

TypeScript 6+ (and tsgo from 7.0.0-dev.20260221.1) now errors on non-ambient declare module Foo {} declarations (TS1540), requiring declare namespace Foo {} instead.

This PR changes the single occurrence in src/public/index.d.ts (line 42):

-declare module Dexie {
+declare namespace Dexie {

The module and namespace keywords are functionally identical for this use case — this is a purely syntactic change with no runtime or type-level impact.

Verified

  • This is the only non-ambient declare module in the repo
  • Addon files (Dexie.Syncable, Dexie.Observable, dexie-cloud) all use declare module 'dexie' (quoted string — ambient module augmentation), which is valid and unaffected
  • Binary-searched tsgo dev builds to confirm the breaking change was introduced in 7.0.0-dev.20260221.1 (Feb 21, 2026)

Summary by CodeRabbit

  • Refactor
    • Updated TypeScript type declaration structure for improved type system consistency. This change does not affect the public API or functionality.

…ompatibility

TypeScript 6+ (and tsgo from 7.0.0-dev.20260221.1) now errors on
non-ambient `declare module Foo {}` declarations (TS1540), requiring
`declare namespace Foo {}` instead.

This was deprecated in microsoft/TypeScript#62876 (merged Dec 2025).

The `module` and `namespace` keywords are functionally identical for
this use case, so this is a purely syntactic change with no runtime
or type-level impact.

Fixes #2248
@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d59cc44 and 2bfbf5b.

📒 Files selected for processing (1)
  • src/public/index.d.ts

📝 Walkthrough

Walkthrough

This change updates the TypeScript type declarations in Dexie's public API to replace the deprecated declare module syntax with declare namespace, addressing incompatibility with TypeScript 6 and later versions.

Changes

Cohort / File(s) Summary
TypeScript Declaration Update
src/public/index.d.ts
Replaced declare module Dexie { with declare namespace Dexie { to comply with TypeScript 6+ requirements and eliminate compilation errors in newer TypeScript versions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A namespace blooms where modules fade,
TypeScript's rules have newly swayed,
One simple fix, a syntax dance,
Dexie hops into TS6's trance! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing the 'module' keyword with 'namespace' in TypeScript declarations for TypeScript 6/7 compatibility.
Linked Issues check ✅ Passed The code change directly addresses issue #2248 by replacing 'declare module Dexie' with 'declare namespace Dexie' to fix TS1540 errors in TypeScript 6/7.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to fixing the specific TypeScript compatibility issue identified in #2248, with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

joelburget added a commit to survivalandflourishing/Dexie.js that referenced this pull request Feb 24, 2026
See dexie#2249. We'll use this vendored
version until fixed upstream.
@dfahlander dfahlander merged commit 4aea3a7 into dexie:master Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatibility with typescript 6/7

2 participants