@@ -350,7 +350,7 @@ function assignOnDefect<TContext>(
350350** Example :**
351351
352352` ` ` typescript
353- invoke: {
353+ invoke: invoke( {
354354 src: () => fetchUser(),
355355 onSuccess: {
356356 target: "ready",
@@ -369,7 +369,7 @@ invoke: {
369369 })),
370370 ],
371371 },
372- }
372+ })
373373` ` `
374374
375375-- -
@@ -379,7 +379,7 @@ invoke: {
379379A shorthand for handling all invoke outcomes in one place . Use this when you want to update context without transitioning to different states .
380380
381381` ` ` typescript
382- invoke: {
382+ invoke: invoke( {
383383 src: () => Effect<TOutput, TError, R>,
384384 assignResult: {
385385 success: (params: { context: TContext; output: TOutput }) => Partial<TContext>;
@@ -389,13 +389,13 @@ invoke: {
389389 };
390390 defect?: (params: { context: TContext; defect: unknown }) => Partial<TContext>;
391391 }
392- }
392+ })
393393` ` `
394394
395395** Example :**
396396
397397` ` ` typescript
398- invoke: {
398+ invoke: invoke( {
399399 src: () => fetchWeather(),
400400 assignResult: {
401401 success: ({ output }) => ({
@@ -408,13 +408,13 @@ invoke: {
408408 weather: { status: "crashed", message: String(defect) },
409409 }),
410410 },
411- }
411+ })
412412` ` `
413413
414414** With typed error handling :**
415415
416416` ` ` typescript
417- invoke: {
417+ invoke: invoke( {
418418 src: () => fetchWeather(), // Effect<Weather, NetworkError | ParseError, never>
419419 assignResult: {
420420 success: ({ output }) => ({ weather: output }),
@@ -429,7 +429,7 @@ invoke: {
429429 failure: ({ error }) => ({ error: error.message }), // Fallback
430430 defect: ({ defect }) => ({ error: String(defect) }),
431431 },
432- }
432+ })
433433` ` `
434434
435435## See Also
0 commit comments