-
Notifications
You must be signed in to change notification settings - Fork 28
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
Typescript expected number of arguments when using defaultTo() #164
Comments
Nothing wrong with your code. TypeScript definitions have been recently added to the project and they are hard to code and unit test. Thanks for the bug report |
I improved the type definitions with defaultTo() in v4.4.4, released just now. |
Thank you very much for your quick answer. v4.4.4 fixes the typescript error for the ObjectModel example in the Default values assignment chapter. It also fixes it for the code sample in my first post, however I now get another error: class Character extends Model(classSchema).defaultTo(defaultValues) {}
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// |_ typescript: Base constructors must all have the same return type |
Sounds like a limitation of TypeScript, based on my understanding of this issue: microsoft/TypeScript#40110 I can remove the type error but will lose the ability to return the default value as type when no arguments are passed. |
Hello,
Given this code sample:
TypeScript underlines
{ id: "1" }
with the error "Expected 0 arguments, but got 1" when creating a new instance of theCharacter
class.Is there something wrong in this code?
The text was updated successfully, but these errors were encountered: