Type Script paths not working. Even after setting up "baseUrl" property in tsconfig.json

Viewed 763

when I try to import {Model, Mongoose} from 'mongoose', it actually looks for ./src/mongoose.ts that's the file generated by feathers by default. this problem only arises when I use the below property in tsconfig.ts.

"baseUrl": "./src"

I have to use this property in my project and have to avoid that problem too?

when I try to set this property for absolute paths in tsconfig.json. I get an error from file /src/models/users.model.ts.

line generating the error:

import { Model, Mongoose } from 'mongoose';

error generated:-

error TS2614: Module '"mongoose"' has no exported member 'Mongoose'. Did you mean to use 'import Mongoose from "mongoose"' instead?

1 Answers

try this

"baseUrl": "src" and "include": ["src/*.ts"]
Related