Improve type checking for defaultValue
with hasMany: true
#11304
PatrikKozak
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 1 reply
-
Even if I don't set a Default value, I still encounter the problem: The Also I'm never editing any json like that, are you saying that in the Admin interface instead of putting plain string |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, fields like
text
,number
,select
, andrelationship
withhasMany: true
accept adefaultValue
of anySerializableValue
without type errors.Since these fields expect arrays when
hasMany: true
, it would be more intuitive and type-safe fordefaultValue
to explicitly require an array in these cases.Example:
The above should throw a type error since
defaultValue
should be an array whenhasMany: true
, like this:Proposed Change:
hasMany: true
and enforcedefaultValue
to be an array of the expected type (e.g.,string[]
for text fields).hasMany: true
.Considerations:
defaultValue
.Beta Was this translation helpful? Give feedback.
All reactions