Skip to content
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

Don't extend MongooseModuleOptions from Record<string, any> #1742

Closed
2 of 4 tasks
parzhitsky opened this issue Mar 31, 2023 · 4 comments
Closed
2 of 4 tasks

Don't extend MongooseModuleOptions from Record<string, any> #1742

parzhitsky opened this issue Mar 31, 2023 · 4 comments
Labels

Comments

@parzhitsky
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

The definition is too broad, property definitions are ignored, IntelliSense is not working, and there are no property suggestions (other than those from Promise type):

image

Minimum reproduction code

https://tsplay.dev/wXv78m

Steps to reproduce

  1. Create an arbitrary *.ts file
  2. npm i @nestjs/mongoose
  3. import type { MongooseModuleOptions } from '@nestjs/mongoose/dist/interfaces/mongoose-options.interface'
  4. Define an object shaped as MongooseModuleOptions
  5. Inspect object typings, properties, IntelliSense etc.

Expected behavior

The definition is specific, property definitions are picked up, and IntelliSense is working:

image

Package version

9.2.2

mongoose version

No response

NestJS version

No response

Node.js version

18.15.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

This is specifically a typings issue. The only fix needed is to remove extends Record<string, any> from here:

https://github.com/nestjs/mongoose/blob/master/lib/interfaces/mongoose-options.interface.ts#L6

@parzhitsky parzhitsky added the bug label Mar 31, 2023
@kamilmysliwiec
Copy link
Member

Would you like tor create a PR for this issue?

@parzhitsky
Copy link
Contributor Author

Sure, on it

@parzhitsky
Copy link
Contributor Author

PR ready 👆 (#1804), all checks have passed

@kamilmysliwiec
Copy link
Member

Let's track this here #1804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants