Skip to content

How to define VIRTUAL field using typescript models #15045

Discussion options

You must be logged in to vote

I don't think we have a good typing solution for this yet. Using NonAttribute will make .init complain that the property is present, and not adding it will make model methods (create, update, etc…) complain that no value is provided for the virtual attribute.

This is a missing feature. We need to add VirtualAttribute<>

In the meantime, I would recommend using NonAttribute<> & using // @ts-expect-error on .init if it complains

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by filipabacus
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants