Skip to content

Commit

Permalink
fix(angular-query): missing exports InitialDataInfiniteOptions types (#…
Browse files Browse the repository at this point in the history
…7388)

* fix(angular-query): missing exports InitialDataInfiniteOptions types

Add missing @public js-doc comments in infinite-query-options.ts to fix type exports

* add infinite query option types to public api

---------

Co-authored-by: Arnoud de Vries <6420061+arnoud-dv@users.noreply.github.com>
  • Loading branch information
Arthie and arnoud-dv committed May 7, 2024
1 parent fd902a7 commit a567ba2
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/angular-query-experimental/.prettierignore
@@ -1,2 +1,2 @@
# API extractor
*.api.md
etc/**
Expand Up @@ -284,6 +284,26 @@ export type DefinedCreateQueryResult<
TDefinedQueryObserver = DefinedQueryObserverResult<TData, TError>,
> = MapToSignals<TDefinedQueryObserver>

// @public (undocumented)
export type DefinedInitialDataInfiniteOptions<
TQueryFnData,
TError = DefaultError,
TData = InfiniteData<TQueryFnData>,
TQueryKey extends QueryKey = QueryKey,
TPageParam = unknown,
> = CreateInfiniteQueryOptions<
TQueryFnData,
TError,
TData,
TQueryFnData,
TQueryKey,
TPageParam
> & {
initialData:
| NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>
| (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)
}

// @public (undocumented)
export type DefinedInitialDataOptions<
TQueryFnData = unknown,
Expand All @@ -296,8 +316,6 @@ export type DefinedInitialDataOptions<
| (() => NonUndefinedGuard<TQueryFnData>)
}

// Warning: (ae-forgotten-export) The symbol "UndefinedInitialDataInfiniteOptions" needs to be exported by the entry point index.d.ts
//
// @public
export function infiniteQueryOptions<
TQueryFnData,
Expand All @@ -323,8 +341,6 @@ export function infiniteQueryOptions<
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>>
}

// Warning: (ae-forgotten-export) The symbol "DefinedInitialDataInfiniteOptions" needs to be exported by the entry point index.d.ts
//
// @public
export function infiniteQueryOptions<
TQueryFnData,
Expand Down Expand Up @@ -521,6 +537,9 @@ export const injectQueryClient: {
): QueryClient
}

// @public (undocumented)
export type NonUndefinedGuard<T> = T extends undefined ? never : T

// @public
export function provideAngularQuery(
queryClient: QueryClient,
Expand Down Expand Up @@ -632,6 +651,24 @@ export function queryOptions<
queryKey: DataTag<TQueryKey, TQueryFnData>
}

// @public (undocumented)
export type UndefinedInitialDataInfiniteOptions<
TQueryFnData,
TError = DefaultError,
TData = InfiniteData<TQueryFnData>,
TQueryKey extends QueryKey = QueryKey,
TPageParam = unknown,
> = CreateInfiniteQueryOptions<
TQueryFnData,
TError,
TData,
TQueryFnData,
TQueryKey,
TPageParam
> & {
initialData?: undefined
}

// @public (undocumented)
export type UndefinedInitialDataOptions<
TQueryFnData = unknown,
Expand All @@ -644,9 +681,5 @@ export type UndefinedInitialDataOptions<

export * from '@tanstack/query-core'

// Warnings were encountered during analysis:
//
// src/query-options.ts:27:3 - (ae-forgotten-export) The symbol "NonUndefinedGuard" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
```
4 changes: 4 additions & 0 deletions packages/angular-query-experimental/src/index.ts
Expand Up @@ -11,6 +11,10 @@ export type {
} from './query-options'
export { queryOptions } from './query-options'

export type {
DefinedInitialDataInfiniteOptions,
UndefinedInitialDataInfiniteOptions,
} from './infinite-query-options'
export { infiniteQueryOptions } from './infinite-query-options'

export * from './inject-infinite-query'
Expand Down
@@ -1,8 +1,11 @@
import type { DataTag } from '@tanstack/query-core'
import type { InfiniteData } from '@tanstack/query-core'
import type { CreateInfiniteQueryOptions } from './types'
import type { CreateInfiniteQueryOptions, NonUndefinedGuard } from './types'
import type { DefaultError, QueryKey } from '@tanstack/query-core'

/**
* @public
*/
export type UndefinedInitialDataInfiniteOptions<
TQueryFnData,
TError = DefaultError,
Expand All @@ -20,8 +23,9 @@ export type UndefinedInitialDataInfiniteOptions<
initialData?: undefined
}

type NonUndefinedGuard<T> = T extends undefined ? never : T

/**
* @public
*/
export type DefinedInitialDataInfiniteOptions<
TQueryFnData,
TError = DefaultError,
Expand Down
4 changes: 1 addition & 3 deletions packages/angular-query-experimental/src/query-options.ts
@@ -1,5 +1,5 @@
import type { DataTag, DefaultError, QueryKey } from '@tanstack/query-core'
import type { CreateQueryOptions } from './types'
import type { CreateQueryOptions, NonUndefinedGuard } from './types'

/**
* @public
Expand All @@ -13,8 +13,6 @@ export type UndefinedInitialDataOptions<
initialData?: undefined
}

type NonUndefinedGuard<T> = T extends undefined ? never : T

/**
* @public
*/
Expand Down
5 changes: 5 additions & 0 deletions packages/angular-query-experimental/src/types.ts
Expand Up @@ -309,3 +309,8 @@ type Override<TTargetA, TTargetB> = {
? TTargetB[AKey]
: TTargetA[AKey]
}

/**
* @public
*/
export type NonUndefinedGuard<T> = T extends undefined ? never : T

0 comments on commit a567ba2

Please sign in to comment.