Socket
Socket
Sign inDemoInstall

redux

Package Overview
Dependencies
0
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-alpha.6 to 5.0.0-beta.0

28

dist/redux.d.ts

@@ -17,4 +17,13 @@ /**

*/
interface Action<T extends string = string> {
type Action<T extends string = string> = {
type: T;
};
/**
* An Action type which accepts any other properties.
* This is mainly for the use of the `Reducer` type.
* This is not part of `Action` itself to prevent types that extend `Action` from
* having an index signature.
*/
interface UnknownAction extends Action {
[extraProps: string]: unknown;
}

@@ -26,2 +35,3 @@ /**

* having an index signature.
* @deprecated use Action or UnknownAction instead
*/

@@ -83,3 +93,3 @@ interface AnyAction extends Action {

*/
type Reducer<S = any, A extends Action = AnyAction, PreloadedState = S> = (state: S | PreloadedState | undefined, action: A) => S;
type Reducer<S = any, A extends Action = UnknownAction, PreloadedState = S> = (state: S | PreloadedState | undefined, action: A) => S;
/**

@@ -92,3 +102,3 @@ * Object whose values correspond to different reducer functions.

*/
type ReducersMapObject<S = any, A extends Action = AnyAction, PreloadedState = S> = keyof PreloadedState extends keyof S ? {
type ReducersMapObject<S = any, A extends Action = UnknownAction, PreloadedState = S> = keyof PreloadedState extends keyof S ? {
[K in keyof S]: Reducer<S[K], A, K extends keyof PreloadedState ? PreloadedState[K] : never>;

@@ -102,3 +112,3 @@ } : never;

type StateFromReducersMapObject<M> = M[keyof M] extends Reducer<any, any, any> | undefined ? {
[P in keyof M]: M[P] extends Reducer<infer S> ? S : never;
[P in keyof M]: M[P] extends Reducer<infer S, any, any> ? S : never;
} : never;

@@ -116,3 +126,3 @@ /**

*/
type ActionFromReducer<R> = R extends Reducer<any, infer A, any> | undefined ? A : never;
type ActionFromReducer<R> = R extends Reducer<any, infer A, any> ? A : never;
/**

@@ -130,3 +140,3 @@ * Infer action union type from a `ReducersMapObject`.

type PreloadedStateShapeFromReducersMapObject<M> = M[keyof M] extends Reducer<any, any, any> | undefined ? {
[P in keyof M]: M[P] extends (inputState: infer InputState, action: AnyAction) => any ? InputState : never;
[P in keyof M]: M[P] extends (inputState: infer InputState, action: UnknownAction) => any ? InputState : never;
} : never;

@@ -155,3 +165,3 @@

*/
interface Dispatch<A extends Action = AnyAction> {
interface Dispatch<A extends Action = UnknownAction> {
<T extends A>(action: T, ...extraArgs: any[]): T;

@@ -206,3 +216,3 @@ }

*/
interface Store<S = any, A extends Action = AnyAction, StateExt extends {} = {}> {
interface Store<S = any, A extends Action = UnknownAction, StateExt extends {} = {}> {
/**

@@ -578,2 +588,2 @@ * Dispatches an action. It is the only way to trigger a state change.

export { Action, ActionCreator, ActionCreatorsMapObject, ActionFromReducer, ActionFromReducersMapObject, AnyAction, Dispatch, Middleware, MiddlewareAPI, Observable, Observer, PreloadedStateShapeFromReducersMapObject, Reducer, ReducerFromReducersMapObject, ReducersMapObject, StateFromReducersMapObject, Store, StoreCreator, StoreEnhancer, StoreEnhancerStoreCreator, Unsubscribe, ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore, legacy_createStore };
export { Action, ActionCreator, ActionCreatorsMapObject, ActionFromReducer, ActionFromReducersMapObject, AnyAction, Dispatch, Middleware, MiddlewareAPI, Observable, Observer, PreloadedStateShapeFromReducersMapObject, Reducer, ReducerFromReducersMapObject, ReducersMapObject, StateFromReducersMapObject, Store, StoreCreator, StoreEnhancer, StoreEnhancerStoreCreator, UnknownAction, Unsubscribe, ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore, legacy_createStore };
{
"name": "redux",
"version": "5.0.0-alpha.6",
"version": "5.0.0-beta.0",
"description": "Predictable state container for JavaScript apps",

@@ -5,0 +5,0 @@ "license": "MIT",

import { Dispatch } from './types/store'
import {
AnyAction,
ActionCreator,
ActionCreatorsMapObject
} from './types/actions'
import { ActionCreator, ActionCreatorsMapObject, Action } from './types/actions'
import { kindOf } from './utils/kindOf'
function bindActionCreator<A extends AnyAction = AnyAction>(
function bindActionCreator<A extends Action>(
actionCreator: ActionCreator<A>,
dispatch: Dispatch
dispatch: Dispatch<A>
) {

@@ -13,0 +9,0 @@ return function (this: any, ...args: any[]) {

@@ -1,2 +0,2 @@

import { AnyAction, Action } from './types/actions'
import { Action } from './types/actions'
import {

@@ -159,3 +159,3 @@ ActionFromReducersMapObject,

state: StateFromReducersMapObject<typeof reducers> = {},
action: AnyAction
action: Action
) {

@@ -162,0 +162,0 @@ if (shapeAssertionError) {

@@ -36,3 +36,3 @@ // functions

// actions
export { Action, AnyAction } from './types/actions'
export { Action, UnknownAction, AnyAction } from './types/actions'

@@ -39,0 +39,0 @@ export {

@@ -17,3 +17,5 @@ /**

*/
export interface Action<T extends string = string> {
// this needs to be a type, not an interface
// https://github.com/microsoft/TypeScript/issues/15300
export type Action<T extends string = string> = {
type: T

@@ -28,2 +30,14 @@ }

*/
export interface UnknownAction extends Action {
// Allows any extra properties to be defined in an action.
[extraProps: string]: unknown
}
/**
* An Action type which accepts any other properties.
* This is mainly for the use of the `Reducer` type.
* This is not part of `Action` itself to prevent types that extend `Action` from
* having an index signature.
* @deprecated use Action or UnknownAction instead
*/
export interface AnyAction extends Action {

@@ -30,0 +44,0 @@ // Allows any extra properties to be defined in an action.

@@ -1,2 +0,2 @@

import { Action, AnyAction } from './actions'
import { Action, UnknownAction } from './actions'

@@ -32,3 +32,3 @@ /* reducers */

S = any,
A extends Action = AnyAction,
A extends Action = UnknownAction,
PreloadedState = S

@@ -46,3 +46,3 @@ > = (state: S | PreloadedState | undefined, action: A) => S

S = any,
A extends Action = AnyAction,
A extends Action = UnknownAction,
PreloadedState = S

@@ -68,3 +68,3 @@ > = keyof PreloadedState extends keyof S

? {
[P in keyof M]: M[P] extends Reducer<infer S> ? S : never
[P in keyof M]: M[P] extends Reducer<infer S, any, any> ? S : never
}

@@ -89,5 +89,3 @@ : never

*/
export type ActionFromReducer<R> = R extends
| Reducer<any, infer A, any>
| undefined
export type ActionFromReducer<R> = R extends Reducer<any, infer A, any>
? A

@@ -116,3 +114,3 @@ : never

inputState: infer InputState,
action: AnyAction
action: UnknownAction
) => any

@@ -119,0 +117,0 @@ ? InputState

@@ -1,2 +0,2 @@

import { Action, AnyAction } from './actions'
import { Action, UnknownAction } from './actions'
import { Reducer } from './reducers'

@@ -27,3 +27,3 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars

*/
export interface Dispatch<A extends Action = AnyAction> {
export interface Dispatch<A extends Action = UnknownAction> {
<T extends A>(action: T, ...extraArgs: any[]): T

@@ -84,3 +84,3 @@ }

S = any,
A extends Action = AnyAction,
A extends Action = UnknownAction,
StateExt extends {} = {}

@@ -87,0 +87,0 @@ > {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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