TypeScript is not inferring types correctly when models imported from NPM package #14092
Unanswered
akashshyam
asked this question in
Q&A
Replies: 1 comment
-
How are you listing mongoose as a dep in your private npm package vs your main project? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey guys!
This is my first time defining and using Models as a separate private NPM package.
This is what I'm exporting:
When I import this after installing the package:
Here, TypeScript infers
company
asany
. Whereas if I create a similar example in the models file, then:Here,
company
is inferred as:Is this expected behaviour? Or am I doing something wrong?
Just for context, here are my Schema and model definitions:
And my
typescript.config
:I appreciate any help 😊
Beta Was this translation helpful? Give feedback.
All reactions