@equinor/fusion-observable
Advanced tools
Comparing version 8.3.1 to 8.3.2
@@ -19,6 +19,5 @@ export function createAction(type, prepareAction) { | ||
export const matchActionSuffix = (suffix) => new RegExp(`${actionSuffixDivider}${suffix}$`); | ||
export const actionBaseType = (action) => { | ||
const type = typeof action === 'string' ? action : action.type; | ||
export function getBaseType(type) { | ||
return type.replace(matchActionSuffix('\\w+$'), ''); | ||
}; | ||
} | ||
export function getType(actionCreator) { | ||
@@ -25,0 +24,0 @@ return `${actionCreator}`; |
@@ -7,3 +7,3 @@ export { castDraft } from 'immer'; | ||
export { actionMapper } from './action-mapper'; | ||
export { createAction, actionBaseType, } from './create-action'; | ||
export { createAction, getBaseType } from './create-action'; | ||
export { createAsyncAction, isRequestAction, isCompleteAction, isFailureAction, isSuccessAction, } from './create-async-action'; | ||
@@ -10,0 +10,0 @@ export { createReducer } from './create-reducer'; |
@@ -1,2 +0,2 @@ | ||
export const version = '8.3.1'; | ||
export const version = '8.3.2'; | ||
//# sourceMappingURL=version.js.map |
@@ -45,5 +45,6 @@ import { Action, PayloadAction } from './types/actions'; | ||
export declare const matchActionSuffix: (suffix: string) => RegExp; | ||
export declare const actionBaseType: (action: Action | string) => string; | ||
type BaseType<T extends string> = T extends `${infer A}${typeof actionSuffixDivider}${infer R}` ? A : never; | ||
export declare function getBaseType<T extends string>(type: T): BaseType<T>; | ||
export declare function getType<T extends string>(actionCreator: PayloadActionCreator<any, T>): T; | ||
type IfPrepareActionMethodProvided<PA extends PrepareAction<any> | void, True, False> = PA extends (...args: any[]) => any ? True : False; | ||
export {}; |
@@ -7,5 +7,5 @@ export { castDraft } from 'immer'; | ||
export { actionMapper, type ActionCalls } from './action-mapper'; | ||
export { createAction, actionBaseType, type ActionCreatorWithPreparedPayload, } from './create-action'; | ||
export { createAction, getBaseType, type ActionCreatorWithPreparedPayload } from './create-action'; | ||
export { createAsyncAction, isRequestAction, isCompleteAction, isFailureAction, isSuccessAction, } from './create-async-action'; | ||
export { createReducer, ActionReducerMapBuilder } from './create-reducer'; | ||
export { createState, type FlowState } from './create-state'; |
@@ -32,2 +32,3 @@ export type TypeConstant = string; | ||
export type ActionType<T> = T extends ActionCreator ? ActionType<ActionInstance<T>> : T extends Action ? T['type'] : never; | ||
export type ActionBaseType<TAction extends Action> = TAction extends Action ? TAction['type'] extends `${infer AName}::${infer ASuffix}` ? AName : TAction['type'] : never; | ||
export type ActionPayloadType<T> = ActionInstance<T> extends PayloadAction<any> ? ActionInstance<T>['payload'] : never; | ||
@@ -34,0 +35,0 @@ export type ExtractAction<TAction extends Action, TType extends TypeConstant = ActionType<TAction>> = Extract<TAction, Action<TType>>; |
@@ -1,1 +0,1 @@ | ||
export declare const version = "8.3.1"; | ||
export declare const version = "8.3.2"; |
{ | ||
"name": "@equinor/fusion-observable", | ||
"version": "8.3.1", | ||
"version": "8.3.2", | ||
"description": "WIP", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152516
771