TypeError: validate_1.Schema is not a constructor
See original GitHub issueI keep getting TypeError: validate_1.Schema is not a constructor. My code is below.
import Schema from 'validate';
import { IUser } from '../common/interfaces';
const userSchema = new Schema({
userName: {
type: String,
required: true,
length: { min: 3 },
message: {
type: 'The user name must be a string.',
required: 'A user name must be provided.',
length: 'A user name must be at least 3 characters.'
}
}
});
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
mongoose TypeError: Schema is not a constructor
I have encountered the same thing. I have previous code like this var mongoose = require('mongoose'); var Schema = mongoose.Schema(); var schema =...
Read more >TypeError: Schema is not a constructor (Example) - Treehouse
Hi all. I wonder if someone can help me, please. :) Here's my code:
Read more >Mongoose model TypeError: Schema is not a constructor ...
[Solved]-Mongoose model TypeError: Schema is not a constructor-node.js ... The error is because your const mongoose has the instance of mongoose.connect and not ......
Read more >schemastery - npm
Lightweight. Much smaller than other validation libraries. Easy to use. You can use any schema as a function or constructor directly. Powerful. Schemastery ......
Read more >Mongoose v6.8.2: Validation
model('Cat', schema); // This cat has no name :( const cat = new Cat(); let error; try { await cat.save ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Did the same as you import schema from ‘validate’
Same problem: FAIL tests/Validator.spec.ts ● Test suite failed to run
Thank you @DragonRaider5 for fixing this. Are there any plans to merge the change and release a new version?