-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Currently we require type casts for component value types like AddressData and UploadedFileData (and the CustomerProfile) which are valid JSON-serializable interfaces but are not assignable to JSONObject because of the missing string index.
The JSONValue / JSONObject types express that the data is inherently exchanged over the wire as JSON, but this doesn't work 100% with this intent in the TS type system. We also want to more strictly model the component value type where we have more information, so relaxing to wider types breaks DX and IDE autocompletion & removes strong guarantees that we know we have.
Examples of where this is happening:
| return {[key]: defaultValue as unknown as JSONObject}; |
| return {[key]: [] satisfies JSONObject[]}; |
| return {[key]: defaultValue as unknown as JSONValue[]}; |
| return {[key]: defaultValue as JSONObject[]}; |
And cases where we discussed this:
We can only address this once we don't depend on formio.js SDK at all anymore.