AFAIK using either struct or struct! doesn’t let Dialyzer “see” what’s happening, and that’s what’s doing the type-enforcement when you use something like typed_struct. The only difference between the two is that struct silently ignores keys it doesn’t understand, while struct! raises.
Writing a literal will complain, though: %SomeStruct{key: "value_of_wrong_type"}.
You could accomplish a similar result by carefully type-specing your new function as well.


















