# @rnw-community/shared

> Shared useful utils and types

Latest version **2.15.0** (published 2026-08-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rnw-community/shared
pnpm add @rnw-community/shared
yarn add @rnw-community/shared
bun add @rnw-community/shared
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.15.0 |
| Published | 2026-08-26 |
| First published | 2020-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.0.0 |
| Dependencies | 0 |
| Unpacked size | 76.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 79 |
| Maintainers | vitalyiegorov |
| Keywords | generic utils, helpers, react, react-native, react native, react-native-web |

## Links

- npm: https://www.npmjs.com/package/@rnw-community/shared
- Repository: https://github.com/rnw-community/rnw-community
- Homepage: https://github.com/rnw-community/rnw-community#readme
- Issues: https://github.com/rnw-community/rnw-community/issues
- npm.io page: https://npm.io/package/@rnw-community/shared

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.15.0 (latest) — 2026-08-26
- 2.13.0 — 2026-08-18
- 2.12.13 — 2026-08-10
- 2.12.12 — 2026-08-09
- 2.12.10 — 2026-08-06
- 2.12.9 — 2026-08-05
- 2.12.7 — 2026-08-05
- 2.12.6 — 2026-08-04
- 2.12.5 — 2026-08-03
- 2.12.2 — 2026-08-03
- 2.9.0 — 2026-08-02
- 2.2.0 — 2026-05-09
- 2.1.0 — 2026-05-09
- 2.0.0 — 2026-04-24
- 1.12.1 — 2026-02-17
- … 148 more at https://npm.io/package/@rnw-community/shared/versions

## README

# Shared

Generic types, type guards and utilities commonly used across packages.

[![npm version](https://badge.fury.io/js/%40rnw-community%2Fshared.svg)](https://badge.fury.io/js/%40rnw-community%2Fshared)
[![coverage](https://img.shields.io/codecov/c/github/rnw-community/rnw-community?flag=shared&label=coverage)](https://app.codecov.io/gh/rnw-community/rnw-community)
[![npm downloads](https://img.shields.io/npm/dm/%40rnw-community%2Fshared.svg)](https://www.npmjs.com/package/%40rnw-community%2Fshared)

## Type guards

Convenient [TypeScript type guards](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) for everyday usage.

> These type guards make your code more explicit, readable, and type-safe — both at runtime and in TypeScript's flow analysis.

- Generic:
    - [isDefined](src/type-guard/generic/is-defined/is-defined.md)
    - [isError](src/type-guard/generic/is-error/is-error.md)
    - [isObject](src/type-guard/generic/is-object/is-object.md)
    - [isPromise](src/type-guard/generic/is-promise/is-promise.md)
    - [isRecord](src/type-guard/generic/is-record/is-record.md) - non-array objects that are safe to index by key
- Array:
    - [isArray](src/type-guard/array/is-array/is-array.md)
    - [isEmptyArray](src/type-guard/array/is-empty-array/is-empty-array.md)
    - [isNotEmptyArray](src/type-guard/array/is-not-empty-array/is-not-empty-array.md)
    - [isNotEmptyArrayOf](src/type-guard/array/is-not-empty-array-of/is-not-empty-array-of.md)
- String:
    - [isString](src/type-guard/string/is-string/is-string.md)
    - [isEmptyString](src/type-guard/string/is-empty-string/is-empty-string.md)
    - [isNotEmptyString](src/type-guard/string/is-not-empty-string/is-not-empty-string.md)
    - [isDecimalMonetaryValue](src/type-guard/string/is-decimal-monetary-value/is-decimal-monetary-value.md) - decimal-formatted numeric string, e.g. currency amounts
- Number:
    - [isNumber](src/type-guard/number/is-number/is-number.md)
    - [isPositiveNumber](src/type-guard/number/is-positive-number/is-positive-number.md)
- Boolean:
    - [isBoolean](src/type-guard/boolean/is-boolean/is-boolean.md)

## Utils

Utility functions that helps with everyday tasks:

- [getErrorMessage](src/util/get-error-message/get-error-message.md) - Get typesafe Error object message.
- [emptyFn](src/util/empty-fn/empty-fn.md) - Useful default react prop callback value.
- [cs](src/util/cs/cs.md) - Conditional styling util.
- [getDefined](src/util/get-defined/get-defined.md) - Get fallback value if passed variable is not defined.
- [wait](src/util/wait/wait.md) - Promise-based sleep via `setTimeout`.

## Types

Commonly used typescript types:

- [ClassType](src/type/class-type/class.type.md)
- [Maybe](src/type/maybe-type/maybe.type.md)
- [OnEventFn](src/type/on-event-fn-type/on-event-fn.type.md)
- [EmptyFn](src/type/empty-fn-type/empty-fn.type.md)
- [Enum](src/type/enum-type/enum-type.md)
- [IsNotEmptyArray](src/type/is-not-empty-array-type/is-not-empty-array.type.md)
- [ReadonlyIsNotEmptyArray](src/type/readonly-is-not-empty-array-type/readonly-is-not-empty-array.type.md)
- [AnyFn](src/type/any-fn-type/any-fn.type.md)
- [AbstractConstructor](src/type/abstract-constructor-type/abstract-constructor.type.md)
- [MethodDecoratorType](src/type/method-decorator-type/method-decorator.type.md)

## License

This library is licensed under The [MIT License](./LICENSE.md).

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