Socket
Socket
Sign inDemoInstall

react-redux-typescript

Package Overview
Dependencies
0
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-redux-typescript

React / Redux / TypeScript Utils


Version published
Weekly downloads
2.2K
decreased by-0.53%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React / Redux / TypeScript Utils

  • Semantic Versioning
  • No external dependencies
  • 100% test coverage
  • Fully typed Redux (action types, action creators, reducers)
  • Futureproof - output es5 and es6 bundles

Types

/**
 * @type EmptyAction - Empty Action Type
 * @template T - Type
 */
export type EmptyAction<T> = {
  readonly type: T;
}

/**
 * @type PayloadAction - Flux Standard Action Type
 * @template T - Type
 * @template P - Payload
 */
export type PayloadAction<T, P> = {
  readonly type: T;
  readonly payload: P;
  readonly error?: boolean;
}

Helper Functions

/**
 * @export createEmptyAction - empty action creator function
 * @template T - Type
 * @param type: T
 * @returns () => EmptyAction<T>
 */
createEmptyAction<T>(type)

/**
 * @export createPayloadAction - FSA action creator function
 * @template T - Type
 * @template P - Payload
 * @param type: T
 * @returns (payload: P) => PayloadAction<T, P>
 */
createPayloadAction<T, P>(type)

TypeScript Patches

/**
 * @export returntypeof - typeof patch to extract return type of "expression/function"
 * Indispensable until native support will arrive in TS
 * https://github.com/Microsoft/TypeScript/issues/6606
 * @template RT - ReturnType
 * @param expression: (...params: any[]) => RT
 * @returns RT
 */
returntypeof(expression)

Copyright (c) 2016 Piotr Witek piotrek.witek@gmail.com (http://piotrwitek.github.io)

Keywords

FAQs

Last updated on 11 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc