rainbow-actions icon indicating copy to clipboard operation
rainbow-actions copied to clipboard

How declare optional payload?

Open collapsus opened this issue 1 year ago • 1 comments

type PayloadDictionary = { init: boolean; // ^^^^^^ want to be optional, like readOnly?: boolean }

collapsus avatar Jul 11 '23 10:07 collapsus

Payloads cannot be optional by design. IMO it is a bad practice. You can set your payload type as a union undefined | boolean though you would still need to call function with an argument.

antonk52 avatar Jul 11 '23 20:07 antonk52