facebook / prop-types

Runtime type checking for React props and similar objects
MIT License
4.48k stars 356 forks source link

Trouble remembering that 'func' and 'bool' have a shorter name #185

Closed yasuf closed 6 years ago

yasuf commented 6 years ago

This is a suggestion to reduce the mental overhead of remembering which PropTypes have shorter names than the actual name, why is it only that func and bool have short names and not object -> obj or string -> str?

I'd like to understand the reasoning behind this decision and check what opinions other people have, personally I'd rather have long names for all PropTypes, have PropType.function instead of func and PropTypes.boolean instead of bool, would it be too crazy to suggest support for these?

ljharb commented 6 years ago

Because function and boolean are keywords and can’t be used as variable names when destructuring. The others can.

yasuf commented 6 years ago

got it we can close this issue, thanks for explaining!