Default boolean values in model are not handled correctly
In this code, the field isAwesome has default value true:
import { ChiselEntity } from '@chiselstrike/api';
export class Human extends ChiselEntity {
name: string;
isAwesome: boolean = !true;
}
Expected behavior is either that the default value is false, or that chisel apply returns an error.
Note that if I try to do something similar with strings:
nickname: string = "bo" + "b";
then I get an error from chisel apply: error: expression not supported. Same error should perhaps be reported in this case.
After the fix in #1600 this code will be accepted. However, we handle expressions differently than we handle literals, and those examples could be literals, but will end up being treated as expressions.
Leaving it open for a bit longer until we can treat them as the literals that they are.
Hmm, so what is the difference between a literal and expression default value? It might be confusing if isAwesome: boolean = false behaves differently from isAwesome: boolean = !true.
it is confusing, which is why I am leaving this issue open and not closing with the other fix =p
The difference is that for literals, we can make the property hot-addable and/or removable.