-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Mongoose types failing to load #27042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have a similar bug. The bug was not reproduced in Deno 2.0.0, but reproduced in Deno 2.1.1. And, if |
Possibly related to #27215 |
I don't think this is actually related to #27215, I tried the provide reproduction and can say that something definitely goes wrong. The "missing" files are definitely there, next to the file containing all the errors, but Deno LSP is not able to resolve them. |
I have a very similar issue (also with mongoose types). How would I get the output from deno to see if it is also not finding the files, or the list of files it didn't find? I am working with VS Code and what I have to do at the moment to get my mongoose types working with >2.0.3 is:
If I then would close code again, I need to redo the same. Let me know if I can help somehow. Sadly I have no Rust knowledge... |
Just experienced this issue, however, I noticed that using an import map for Mongoose was why I was facing this problem, with complete type stripping occurring. Instead importing directly with the npm specifier in my .ts files gave the types I was looking for. |
Well, this is by no means the solution, but if you need to make something fast or just experimenting with mongoose+deno and types are blocking you than do the following:
export * from './aggregate.d.ts';
export * from './callback.d.ts';
export * from './collection.d.ts';
export * from './connection.d.ts';
export * from './cursor.d.ts';
export * from './document.d.ts';
export * from './error.d.ts';
export * from './expressions.d.ts';
export * from './helpers.d.ts';
export * from './middlewares.d.ts';
export * from './indexes.d.ts';
export * from './models.d.ts';
export * from './mongooseoptions.d.ts';
export * from './pipelinestage.d.ts';
export * from './populate.d.ts';
export * from './query.d.ts';
export * from './schemaoptions.d.ts';
export * from './schematypes.d.ts';
export * from './session.d.ts';
export * from './types.d.ts';
export * from './utility.d.ts';
export * from './validation.d.ts';
export * from './inferrawdoctype.d.ts';
export * from './inferschematype.d.ts';
export * from './virtuals.d.ts';
export * from './augmentations.d.ts'; |
|
Temporary hack:
/// <reference path="../../node_modules/mongoose/types/index.d.ts" /> You might need |
That totally works! Thanks for the temporary fix. |
Problem still persists in version 2.1.5. |
Looks like this has the same cause as another issue I'm working on, so assigning to myself |
The hack for replacing Does this issue just happen in IDE or does it also happen at runtime? |
Only IDE, in runtime deno is able to run the methods as expected. |
… to augment `ImportMeta` (#27690) Fixes #26224. Fixes #27042. There were three bugs here: - we were only resolving `/// <reference types` directives starting with `npm:`, which meant we failed to resolve bare specifiers (this broke the `/// <reference types="vite/client">` directive in most of the vite templates) - the `$node_modules` workaround caused us to fail to read files for tsc. For instance tsc would construct new paths based on specifiers containing `$node_modules`, and since we hadn't created those we weren't mapping them back to the original (this broke some type resolution within `vite/client`) - our separation of `ImportMeta` across node and deno globals in tsc meant that npm packages couldn't augment `ImportMeta` (this broke `vite/client`'s augmentation to add `import.meta.env` and others) After this, the only remaining issue in the vanilla vite template is our error on `/vite.svg` (which is an ambient module), and I'll look into that next.
Version: Deno 2.1.1 and 2.1.0
Works properly in 2.0.0
The text was updated successfully, but these errors were encountered: