Comparing version 9.0.0-beta.0 to 9.0.0-beta.1
@@ -49,3 +49,3 @@ import { Nothing } from "../internal"; | ||
declare type InferInitialStateFromCurried<Curried> = Curried extends (base: infer State, ...rest: any[]) => any ? State : never; | ||
declare type InferCurriedFromRecipe<Recipe, UsePatches extends boolean> = Recipe extends (draft: infer DraftState, ...args: infer RestArgs) => any ? ReturnType<Recipe> extends ValidRecipeReturnTypePossiblyPromise<DraftState> ? (base: Immutable<DraftState>, ...args: RestArgs) => PromisifyReturnIfNeeded<Immutable<DraftState>, Recipe, UsePatches> : never : never; | ||
declare type InferCurriedFromRecipe<Recipe, UsePatches extends boolean> = Recipe extends (draft: infer DraftState, ...args: infer RestArgs) => any ? ReturnType<Recipe> extends ValidRecipeReturnTypePossiblyPromise<DraftState> ? (base: Immutable<DraftState>, ...args: RestArgs) => PromisifyReturnIfNeeded<DraftState, Recipe, UsePatches> : never : never; | ||
declare type InferCurriedFromInitialStateAndRecipe<State, Recipe, UsePatches extends boolean> = Recipe extends (draft: Draft<State>, ...rest: infer RestArgs) => ValidRecipeReturnTypePossiblyPromise<State> ? (base?: State | undefined, ...args: RestArgs) => PromisifyReturnIfNeeded<State, Recipe, UsePatches> : never; | ||
@@ -76,2 +76,5 @@ /** | ||
<Recipe extends AnyFunc>(recipe: Recipe): InferCurriedFromRecipe<Recipe, false>; | ||
/** Curried producer that infers curried from the State generic, which is explicitly passed in. */ | ||
<State>(recipe: (state: Draft<State>) => ValidRecipeReturnType<State>): (state: State) => State; | ||
<State, Args extends any[]>(recipe: (state: Draft<State>, ...args: Args) => ValidRecipeReturnType<State>): (state: State, ...args: Args) => State; | ||
/** Curried producer with initial state, infers recipe from initial state */ | ||
@@ -78,0 +81,0 @@ <State, Recipe extends Function>(recipe: Recipe, initialState: State): InferCurriedFromInitialStateAndRecipe<State, Recipe, false>; |
{ | ||
"name": "immer", | ||
"version": "9.0.0-beta.0", | ||
"version": "9.0.0-beta.1", | ||
"description": "Create your next immutable state by mutating the current one", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -135,5 +135,5 @@ import {Nothing} from "../internal" | ||
? ( | ||
base: Immutable<DraftState>, | ||
...args: RestArgs | ||
) => PromisifyReturnIfNeeded<Immutable<DraftState>, Recipe, UsePatches> | ||
base: Immutable<DraftState>, | ||
...args: RestArgs | ||
) => PromisifyReturnIfNeeded<DraftState, Recipe, UsePatches> // N.b. we return mutable draftstate, in case the recipe's first arg isn't read only, and that isn't expected as output either | ||
: never // incorrect return type | ||
@@ -182,2 +182,3 @@ : never // not a function | ||
/** Curried producer that infers curried from the recipe */ | ||
@@ -189,2 +190,6 @@ <Recipe extends AnyFunc>(recipe: Recipe): InferCurriedFromRecipe< | ||
/** Curried producer that infers curried from the State generic, which is explicitly passed in. */ | ||
<State>(recipe: (state: Draft<State>) => ValidRecipeReturnType<State>): (state: State) => State | ||
<State, Args extends any[]>(recipe: (state: Draft<State>, ...args: Args) => ValidRecipeReturnType<State>): (state: State, ...args: Args) => State | ||
/** Curried producer with initial state, infers recipe from initial state */ | ||
@@ -191,0 +196,0 @@ <State, Recipe extends Function>( |
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
837684
6563