formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

[BUG] ComponentSchema.persistent should be of type (boolean | 'client-only')

Open davebaol opened this issue 5 years ago • 3 comments

Environment

Please provide as many details as you can:

  • Hosting type
    • [ ] Form.io
    • [ ] Local deployment
      • Version:
  • Formio.js version: 4.9.27-rc.4
  • Frontend framework:
  • Browser:
  • Browser version:

Steps to Reproduce

Setting the property persistent to client-only is a bit tricky:

const schema: ExtendedComponentSchema = {
    hideLabel: true
};
(schema as any).persistent = 'client-only';

Expected behavior

It should be as simple as

const schema: ExtendedComponentSchema = {
    hideLabel: true,
    persistent: 'client-only'
};

Observed behavior

Currently you get the error Type 'string' is not assignable to type 'boolean' because persistent is of type boolean instead of boolean | 'client-only'

davebaol avatar Jun 16 '20 10:06 davebaol

@davebaol Hi could you please confirm if this issue persists in version 4.10.2?

jeriah-formio avatar Jun 16 '20 13:06 jeriah-formio

@jhen1422 I'd say yes, the issue is still there in 4.10.2: https://github.com/formio/formio.js/blob/v4.10.2/types/components/schema.d.ts#L71

davebaol avatar Jun 16 '20 14:06 davebaol

I am using 4.13.8 and the issue is still there.

joaorodr84 avatar Jul 21 '22 10:07 joaorodr84

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!

daneformio avatar Feb 14 '24 14:02 daneformio