Skip to content

Deal with non-primitive component value types #202

@sergei-maertens

Description

@sergei-maertens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions