Closed chengjianhua closed 5 years ago
Agreed though I would suggest exporting a function named required() and just replacing the .isRequired syntax with required() going forward. Leave the other for compatibility, but
import { required, string } from 'prop-types';
const propTypes = { name: required(string), somethingCrazy: requried(somethingCrazy) }
is a lot more idiomatic IMO.
Duplicate of #149.
Feature Request:
All the type checkers of
PropTypes
are created bycreateChainableTypeChecker
to create type checker with the chainable propertyisRequired
.Developers are also want to create the custom type checker keeps the same style of native type checkers provided by
PropTypes
and without the effort to repeat the work thatprop-types
have done. Okay, I know that we could do this ourselves, but if this will be provided, things are more easier and consistent.So, It's feasible to export the
createChainbleTypeChecker
to developers ? BTW, may a shorter name.