buildo / react-components

Collection of general React components used in buildo projects.
http://react-components.buildo.io/
MIT License
157 stars 21 forks source link

Button: label static vs. runtime prop differ, potentially causing undesired tcomb errors in console #1264

Closed giogonzo closed 5 years ago

giogonzo commented 6 years ago

Project card

description

For TS, all keys are optional: https://github.com/buildo/react-components/blob/master/src/Button/Button.tsx#L46

But if processing is not passed, a tcomb error message appears

how to reproduce

specs

{optional: describe a possible fix for this defect, if not obvious}

misc

{optional: other useful info}

FrancescoCioria commented 5 years ago

@giogonzo I cannot reproduce this error:

image

FrancescoCioria commented 5 years ago

@giogonzo ping

giogonzo commented 5 years ago

This is the original error on the project: image Which has now been fixed by providing more labels to the button

Re-reading this, I think the only issue here is that Button is defaulting some labels (ready and not-allowed) but not others (processing, success and error) so this caused some confusion.

The issue about the types (static and runtime) not being coherent instead seems not valid: t.dict(Domain, Codomain) produces a dictionary with optional keys in the domain -> same as using Partial<>, am I right? But at the same time, looking at the error above this seems not true 🤔

I'm confused, and probably something has changed in Button source code on this repo in the meantime, but since we can't reproduce, I would ignore this for the moment