@tanstack/react-router 0.0.1-beta.150 → 0.0.1-beta.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.150",
4
+ "version": "0.0.1-beta.152",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
@@ -43,8 +43,8 @@
43
43
  "tiny-invariant": "^1.3.1",
44
44
  "tiny-warning": "^1.0.3",
45
45
  "@gisatcz/cross-package-react-context": "^0.2.0",
46
- "@tanstack/router-core": "0.0.1-beta.150",
47
- "@tanstack/react-store": "0.0.1-beta.150"
46
+ "@tanstack/react-store": "0.0.1-beta.152",
47
+ "@tanstack/router-core": "0.0.1-beta.152"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "rollup --config rollup.config.js"
package/src/index.tsx CHANGED
@@ -31,6 +31,7 @@ import {
31
31
  UseLoaderResult,
32
32
  ResolveFullSearchSchema,
33
33
  Route,
34
+ RouteConstraints,
34
35
  } from '@tanstack/router-core'
35
36
 
36
37
  //
@@ -49,45 +50,42 @@ declare module '@tanstack/router-core' {
49
50
 
50
51
  // Extend the Route class to have some React-Specific methods
51
52
  interface Route<
52
- TParentRoute extends AnyRoute = AnyRoute,
53
- TPath extends string = '/',
54
- TFullPath extends ResolveFullPath<TParentRoute, TPath> = ResolveFullPath<
53
+ TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,
54
+ TPath extends RouteConstraints['TPath'] = '/',
55
+ TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<
55
56
  TParentRoute,
56
57
  TPath
57
58
  >,
58
- TCustomId extends string = string,
59
- TId extends ResolveId<TParentRoute, TCustomId, TPath> = ResolveId<
59
+ TCustomId extends RouteConstraints['TCustomId'] = string,
60
+ TId extends RouteConstraints['TId'] = ResolveId<
60
61
  TParentRoute,
61
62
  TCustomId,
62
63
  TPath
63
64
  >,
64
65
  TLoader = unknown,
65
- TSearchSchema extends AnySearchSchema = {},
66
- TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<
66
+ TSearchSchema extends RouteConstraints['TSearchSchema'] = {},
67
+ TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<
67
68
  TParentRoute,
68
69
  TSearchSchema
69
70
  >,
70
- TParams extends Record<ParsePathParams<TPath>, any> = Record<
71
+ TParams extends RouteConstraints['TParams'] = Record<
71
72
  ParsePathParams<TPath>,
72
73
  string
73
74
  >,
74
- TAllParams extends MergeParamsFromParent<
75
+ TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<
75
76
  TParentRoute['__types']['allParams'],
76
77
  TParams
77
- > = MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams>,
78
- TParentContext extends TParentRoute['__types']['routeContext'] = TParentRoute['__types']['routeContext'],
79
- TAllParentContext extends TParentRoute['__types']['context'] = TParentRoute['__types']['context'],
80
- TRouteContext extends RouteContext = RouteContext,
81
- TContext extends MergeParamsFromParent<
82
- TParentRoute['__types']['context'],
83
- TRouteContext
84
- > = MergeParamsFromParent<
78
+ >,
79
+ TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['__types']['routeContext'],
80
+ TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['__types']['context'],
81
+ TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
82
+ TContext extends RouteConstraints['TContext'] = MergeParamsFromParent<
85
83
  TParentRoute['__types']['context'],
86
84
  TRouteContext
87
85
  >,
88
- TRouterContext extends AnyContext = AnyContext,
89
- TChildren extends unknown = unknown,
90
- TRoutesInfo extends DefaultRoutesInfo = DefaultRoutesInfo,
86
+ TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
87
+ TChildren extends RouteConstraints['TChildren'] = unknown,
88
+ TRoutesInfo extends RouteConstraints['TRoutesInfo'] = DefaultRoutesInfo,
91
89
  > {
92
90
  useMatch: <TStrict extends boolean = true, TSelected = TContext>(opts?: {
93
91
  strict?: TStrict
@@ -385,19 +383,18 @@ export function useLinkProps<
385
383
  }
386
384
  }
387
385
 
388
- export interface LinkFn<
389
- TDefaultFrom extends RegisteredRoutesInfo['routePaths'] = '/',
390
- TDefaultTo extends string = '',
391
- > {
386
+ export interface LinkComponent<TProps extends Record<string, any> = {}> {
392
387
  <
393
- TFrom extends RegisteredRoutesInfo['routePaths'] = TDefaultFrom,
394
- TTo extends string = TDefaultTo,
388
+ TFrom extends RegisteredRoutesInfo['routePaths'] = '/',
389
+ TTo extends string = '',
395
390
  >(
396
- props: MakeLinkOptions<TFrom, TTo> & React.RefAttributes<HTMLAnchorElement>,
391
+ props: MakeLinkOptions<TFrom, TTo> &
392
+ TProps &
393
+ React.RefAttributes<HTMLAnchorElement>,
397
394
  ): ReactNode
398
395
  }
399
396
 
400
- export const Link: LinkFn = React.forwardRef((props: any, ref) => {
397
+ export const Link: LinkComponent = React.forwardRef((props: any, ref) => {
401
398
  const linkProps = useLinkProps(props)
402
399
 
403
400
  return (