Skip to content

Commit

Permalink
ci: apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Aug 21, 2024
1 parent 081cba0 commit 62dc7a8
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 45 deletions.
11 changes: 9 additions & 2 deletions packages/angular-query-experimental/src/__tests__/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { type InputSignal, type Signal, isSignal, untracked } from '@angular/core'
import {
type InputSignal,
type Signal,
isSignal,
untracked,
} from '@angular/core'
import { SIGNAL, signalSetFn } from '@angular/core/primitives/signals'
import type { ComponentFixture } from '@angular/core/testing'

Expand Down Expand Up @@ -86,7 +91,9 @@ function evaluateSignals<T extends Record<string, any>>(

export const expectSignals = <T extends Record<string, any>>(
obj: T,
expected: Partial<{ [K in keyof T]: T[K] extends Signal<any> ? ReturnType<T[K]> : never }>,
expected: Partial<{
[K in keyof T]: T[K] extends Signal<any> ? ReturnType<T[K]> : never
}>,
): void => {
expect(evaluateSignals(obj)).toMatchObject(expected)
}
Expand Down
100 changes: 57 additions & 43 deletions packages/angular-query-experimental/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ type CreateStatusBasedMutationResult<
{ status: TStatus }
>

type SignalFunction<T extends () => any> = T & Signal<ReturnType<T>>;
type SignalFunction<T extends () => any> = T & Signal<ReturnType<T>>

/**
* @public
Expand All @@ -233,60 +233,74 @@ export interface BaseMutationNarrowing<
TVariables = unknown,
TContext = unknown,
> {
isSuccess: SignalFunction<(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext,
CreateStatusBasedMutationResult<
'success',
isSuccess: SignalFunction<
(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext
TContext,
CreateStatusBasedMutationResult<
'success',
TData,
TError,
TVariables,
TContext
>
>
>>
isError: SignalFunction<(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext,
CreateStatusBasedMutationResult<
'error',
>
isError: SignalFunction<
(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext
TContext,
CreateStatusBasedMutationResult<
'error',
TData,
TError,
TVariables,
TContext
>
>
>>
isPending: SignalFunction<(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext,
CreateStatusBasedMutationResult<
'pending',
>
isPending: SignalFunction<
(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext
TContext,
CreateStatusBasedMutationResult<
'pending',
TData,
TError,
TVariables,
TContext
>
>
>>
isIdle: SignalFunction<(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext,
CreateStatusBasedMutationResult<'idle', TData, TError, TVariables, TContext>
>>
>
isIdle: SignalFunction<
(
this: CreateMutationResult<TData, TError, TVariables, TContext>,
) => this is CreateMutationResult<
TData,
TError,
TVariables,
TContext,
CreateStatusBasedMutationResult<
'idle',
TData,
TError,
TVariables,
TContext
>
>
>
}

/**
Expand Down

0 comments on commit 62dc7a8

Please sign in to comment.