Server: Phase 2 (REVIEW not respected yet)
This commit is contained in:
1 parent
5d16ded553
commit
142b47674d
4271 files changed
+1203269
No files matched your search
+19
@@ -0,0 +1,19 @@
|
||||
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.js';
|
||||
import { AnyRouter, RegisteredRouter, ResolveUseLoaderData, StrictOrFrom, UseLoaderDataResult } from '@tanstack/router-core';
|
||||
export interface UseLoaderDataBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected, TStructuralSharing> {
|
||||
select?: (match: ResolveUseLoaderData<TRouter, TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
||||
}
|
||||
export type UseLoaderDataOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TSelected, TStructuralSharing> = StrictOrFrom<TRouter, TFrom, TStrict> & UseLoaderDataBaseOptions<TRouter, TFrom, TStrict, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
|
||||
export type UseLoaderDataRoute<out TId> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseLoaderDataBaseOptions<TRouter, TId, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseLoaderDataResult<TRouter, TId, true, TSelected>;
|
||||
/**
|
||||
* Read and select the current route's loader data with type‑safety.
|
||||
*
|
||||
* Options:
|
||||
* - `from`/`strict`: Choose which route's data to read and strictness
|
||||
* - `select`: Map the loader data to a derived value
|
||||
* - `structuralSharing`: Enable structural sharing for stable references
|
||||
*
|
||||
* @returns The loader data (or selected value) for the matched route.
|
||||
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook
|
||||
*/
|
||||
export declare function useLoaderData<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseLoaderDataOptions<TRouter, TFrom, TStrict, TSelected, TStructuralSharing>): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>;
|
||||
Reference in new issue
Block a user