We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am trying to define a very simple class, like this:
import { Document, DocumentSchema, SchemaTypeExtended } from 'camo'; export interface UserSchema extends DocumentSchema { email: string; password: string; } export class User extends Document<UserSchema> { public email: SchemaTypeExtended = String; public password: SchemaTypeExtended = String; }
Now, lets assume, I am trying to create a new user:
let newUser = User.create({ email: 'A', password: 'B' }); console.log(newUser.email) // prints 'A', but typescript throws error newUser.save().then(user => { console.log(user.email); // prints 'A' and typescript doesn't complain });
Any idea how I can fix the error?
The text was updated successfully, but these errors were encountered:
I have the same problem as above
Sorry, something went wrong.
Use
let newUser = create<UserSchema>(...)
I mean
let newUser = User.create<UserSchema>(...);
No branches or pull requests
I am trying to define a very simple class, like this:
Now, lets assume, I am trying to create a new user:
Any idea how I can fix the error?
The text was updated successfully, but these errors were encountered: