Moritz Hofmeister
03/16/2022, 2:30 PMmin
attribute and cannot figure out how to do it correctly:
var InputBaseComponentProps.min: String
get() = throw IllegalStateException()
set(value) {
return when (this) {
is HTMLInputElement -> min = value
else -> throw IllegalArgumentException("There is no min in this InputBaseComponentProps")
}
}
This results in an exception because it apparently does not match with HTMLInputElement.
As a reference, this works:
val HTMLElement.value: String
get() = when (this) {
is HTMLInputElement -> value
is HTMLTextAreaElement -> value
else -> throw IllegalArgumentException("There is no value in this HTMLElement")
}
turansky
03/16/2022, 2:31 PMvar InputBaseComponentProps.min: Double?
get() = asDynamic().min
set(value) {
asDynamic().min = value
}
Moritz Hofmeister
03/16/2022, 2:32 PMasDynamic()
turansky
03/16/2022, 2:32 PMInputBaseComponentProps
is simple JS object, like all typical propsturansky
03/16/2022, 2:32 PMMoritz Hofmeister
03/16/2022, 2:33 PMturansky
03/16/2022, 2:33 PMturansky
03/16/2022, 2:35 PMkey
and ref
are write-only, because they are reservedturansky
03/16/2022, 2:36 PM