-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support for nullable types #32
Comments
Hello, @orobert91! Sure, I will take a look at it soon. Thank you for creating an issue! Could you provide some feedback about the library, I would like to make it more useful. |
Hi I took a deeper look at how reflection works in TypeScript and from what I've read it is not possible to retrieve the type from Here are my 2 workarounds:
Option 1 pollutes the models a lot, option 2 is preferable since TypeScript guidelines encourages us to not use null at all (https://github.com/microsoft/TypeScript/wiki/Coding-guidelines) As for the feedback of the library in general, I think it's well done and well designed. I have found 2 additional limitations:
|
Thank you for this research! I think I have to add something about it to the README file. What other steps do you see to improve it? Maybe change the error message or something like that. Could you send a use case for map serialization? I could add a default serializer for dictionaries and maps. |
Yes you could throw a more descriptive error message. It was a generic JavaScript message and I had to dig a lot to understand what was going on. Here is an example class:
And here is the serializer:
The same can be done for Maps as they are very similar. |
Thank you for your feedback! I do appreciate it! I have created sub-tasks for it to track it easier. I will take care of it soon! 😇 |
Placing @field() above field of nullable types such as:
results in a runtime error. Is it possible to add support for this?
The text was updated successfully, but these errors were encountered: