# combined-proptypes

> A react library that combines both propTypes and defaultProps into one function call.

Latest version **1.0.0** (published 2018-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install combined-proptypes
pnpm add combined-proptypes
yarn add combined-proptypes
bun add combined-proptypes
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-10-13 |
| First published | 2018-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 211.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Xander Deseyn |
| Maintainers | xanderd |
| Keywords | combined, proptypes, props, defaultprops |

## Links

- npm: https://www.npmjs.com/package/combined-proptypes
- npm.io page: https://npm.io/package/combined-proptypes

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.7

## Recent versions

- 1.0.0 (latest) — 2018-10-13

## README

# combined-proptypes

## Example

```js
import PropTypes from 'prop-types';

Component.PropTypes = {
  title: PropTypes.string,
  counter: PropTypes.number,
  onPress: PropTypes.func.isRequired
};

Component.defaultProps = {
  title: "no title",
  counter: 0
};
```

becomes:

```js
import { PropTypes, setPropTypes } from 'combined-proptypes';

setPropTypes(Component, {
  title: PropTypes.string("no title"),
  counter: PropTypes.number(0),
  onPress: PropTypes.func.isRequired
});
```



## Why `combined-proptypes`?

- Centralizes the setting of type and default value for props.
- Enforces safe coding practices by requiring you to provide a default value for optional props.

## Supported PropTypes

Currently the following PropTypes are supported:

```
PropTypes.array
PropTypes.array.isRequired
PropTypes.string
PropTypes.string.isRequired
PropTypes.bool
PropTypes.bool.isRequired
PropTypes.func
PropTypes.func.isRequired
PropTypes.number
PropTypes.number.isRequired
PropTypes.object
PropTypes.object.isRequired
PropTypes.symbol
PropTypes.symbol.isRequired
```

More PropTypes might follow if I get around to it ;)

---
_Source: https://npm.io/package/combined-proptypes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
