Skip to content

Remove requirement to use skipLibCheck - #321

Open
vkarpov15 wants to merge 8 commits into
mainfrom
vkarpov15/skiplibcheck
Open

Remove requirement to use skipLibCheck#321
vkarpov15 wants to merge 8 commits into
mainfrom
vkarpov15/skiplibcheck

Conversation

@vkarpov15

@vkarpov15 vkarpov15 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

What this PR does:

Currently astra-mongoose requires client projects set skipLibCheck: true to compile. That is a significant issue because skipLibCheck is all or nothing - in order to use astra-mongoose, client projects need to skip type checking for all node modules.

The major changes are:

  1. Connections now use astraDb instead of db for storing the Astra DB wrapper. Mongoose assumes that db is a MongoDB compatible database wrapper; that means in order to avoid skipLibCheck we either need to have db be MongoDB compatible, or use a different property. I think having astraDb be separate makes more sense because we want to expose an Astra-specific wrapper. Although db -> astraDb is a backwards breaking change, I think it better aligns with the intended usage of this lib - astraDb is meant to be a more Astra-specific wrapper. If we try to make baseDb compatible, we need to implement a wide variety of methods like stats() etc. that throw an error (see here for reference implementation). The idea is that users can use Mongoose directly using this plugin, but also have astraDb as an escape hatch for accessing astra-db-ts directly, which lines up with how Mongoose is meant to be used.
  2. options -> _options on collections. This is more correct because options() is a function on Mongoose collections.
  3. Added TableUpdateFilter<DocType> to updateMany(), findOneAndUpdate() update type union. While not strictly correct currently because updateMany() and findOneAndUpdate() do not support tables, this satisfies the compiler.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@vkarpov15
vkarpov15 marked this pull request as ready for review August 31, 2026 15:43
@vkarpov15
vkarpov15 requested a review from a team as a code owner August 31, 2026 15:43
Copilot AI lite review requested due to automatic review settings August 31, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@toptobes

toptobes commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Although db -> astraDb is a backwards breaking change

You could try having something like

/** @deprecated use {@link astraDb} instead */
get db(): never {
  return this.astraDb as never;
}

to allow js-ers to keep using it at least while making it easier for ts users to migrate? Not sure if it's the best idea but just a suggestion to help w/ backwards compatability

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.

3 participants