Remove requirement to use skipLibCheck - #321
Open
vkarpov15 wants to merge 8 commits into
Open
Conversation
Contributor
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 |
toptobes
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
Currently astra-mongoose requires client projects set
skipLibCheck: trueto compile. That is a significant issue becauseskipLibCheckis all or nothing - in order to use astra-mongoose, client projects need to skip type checking for all node modules.The major changes are:
astraDbinstead ofdbfor storing the Astra DB wrapper. Mongoose assumes thatdbis a MongoDB compatible database wrapper; that means in order to avoid skipLibCheck we either need to havedbbe MongoDB compatible, or use a different property. I think havingastraDbbe separate makes more sense because we want to expose an Astra-specific wrapper. Althoughdb->astraDbis a backwards breaking change, I think it better aligns with the intended usage of this lib -astraDbis meant to be a more Astra-specific wrapper. If we try to makebaseDbcompatible, we need to implement a wide variety of methods likestats()etc. that throw an error (see here for reference implementation). The idea is that users can use Mongoose directly using this plugin, but also haveastraDbas an escape hatch for accessingastra-db-tsdirectly, which lines up with how Mongoose is meant to be used.options->_optionson collections. This is more correct becauseoptions()is a function on Mongoose collections.TableUpdateFilter<DocType>toupdateMany(),findOneAndUpdate()update type union. While not strictly correct currently becauseupdateMany()andfindOneAndUpdate()do not support tables, this satisfies the compiler.Which issue(s) this PR fixes:
Fixes #
Checklist