For Shard::Field if you pass an unpermitted attribute, you'll get a poor error message just telling you "no overload matches". This is true because we do
Then we end up passing in a different type. This would be the same if we did needs id : Int32 and passed in a String.
In lib/lucky/src/lucky/mount_component.cr:32:17
32 | component.new(*args, **named_args).view(view).context(@context).render do |*yield_args|
^--
Error: no overload matches 'Shared::Field(T).new' with types , attribute: Avram::Attribute(String)+, label_text: String
Overloads are:
- Shared::Field(T).new(attribute : Avram::PermittedAttribute(T), label_text : String | ::Nil = nil, **unused_exposures)
Couldn't find overloads for these types:
- Shared::Field(T).new(attribute : Avram::Attribute(String), label_text : String)
I think with other types, this is a bit more noticeable with Avram attributes because you know you're passing in the type you want, you just may have forgot to permit it, and using the Shared::Field hides that error.
Related: https://github.com/luckyframework/avram/issues/850
For
Shard::Field
if you pass an unpermitted attribute, you'll get a poor error message just telling you "no overload matches". This is true because we doThen we end up passing in a different type. This would be the same if we did
needs id : Int32
and passed in a String.I think with other types, this is a bit more noticeable with Avram attributes because you know you're passing in the type you want, you just may have forgot to permit it, and using the Shared::Field hides that error.