@hyeonqyu/typed-router-react 0.1.0 → 0.1.1
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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,8 @@ import * as _hyeonqyu_typed_router_core from '@hyeonqyu/typed-router-core';
|
|
|
3
3
|
export * from '@hyeonqyu/typed-router-core';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
+
type PathValue<T, P extends string, S extends string> = P extends S ? T : P extends `${S}${infer Rest}` ? Rest extends `${infer K}${S}${infer R}` ? K extends keyof T ? PathValue<T[K], `${S}${R}`, S> : never : Rest extends keyof T ? T[Rest] : never : never;
|
|
7
|
+
|
|
6
8
|
declare const createAppRoutes: <TMetadata extends {
|
|
7
9
|
component: ReactNode;
|
|
8
10
|
}, TContext>() => <TRouteTree extends _hyeonqyu_typed_router_core.PartialRouteTree<TMetadata, TContext>>(appRoutes: TRouteTree & _hyeonqyu_typed_router_core.RouteTree<TMetadata, TContext, TRouteTree, TRouteTree>) => {
|
|
@@ -10,7 +12,7 @@ declare const createAppRoutes: <TMetadata extends {
|
|
|
10
12
|
children: ReactNode;
|
|
11
13
|
}) => react_jsx_runtime.JSX.Element;
|
|
12
14
|
useAppRoutes: () => TRouteTree & _hyeonqyu_typed_router_core.RouteTree<TMetadata, TContext, TRouteTree, TRouteTree>;
|
|
13
|
-
useCurrentRouteNode: <TPath extends _hyeonqyu_typed_router_core.RoutePathname<TMetadata, TContext, TRouteTree>>(pathname: TPath) =>
|
|
15
|
+
useCurrentRouteNode: <TPath extends _hyeonqyu_typed_router_core.RoutePathname<TMetadata, TContext, TRouteTree>>(pathname: TPath) => PathValue<TRouteTree, TPath, "/">;
|
|
14
16
|
_types: {
|
|
15
17
|
AppRoutesMetadata: TMetadata;
|
|
16
18
|
AppRoutesContext: TContext;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import * as _hyeonqyu_typed_router_core from '@hyeonqyu/typed-router-core';
|
|
|
3
3
|
export * from '@hyeonqyu/typed-router-core';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
+
type PathValue<T, P extends string, S extends string> = P extends S ? T : P extends `${S}${infer Rest}` ? Rest extends `${infer K}${S}${infer R}` ? K extends keyof T ? PathValue<T[K], `${S}${R}`, S> : never : Rest extends keyof T ? T[Rest] : never : never;
|
|
7
|
+
|
|
6
8
|
declare const createAppRoutes: <TMetadata extends {
|
|
7
9
|
component: ReactNode;
|
|
8
10
|
}, TContext>() => <TRouteTree extends _hyeonqyu_typed_router_core.PartialRouteTree<TMetadata, TContext>>(appRoutes: TRouteTree & _hyeonqyu_typed_router_core.RouteTree<TMetadata, TContext, TRouteTree, TRouteTree>) => {
|
|
@@ -10,7 +12,7 @@ declare const createAppRoutes: <TMetadata extends {
|
|
|
10
12
|
children: ReactNode;
|
|
11
13
|
}) => react_jsx_runtime.JSX.Element;
|
|
12
14
|
useAppRoutes: () => TRouteTree & _hyeonqyu_typed_router_core.RouteTree<TMetadata, TContext, TRouteTree, TRouteTree>;
|
|
13
|
-
useCurrentRouteNode: <TPath extends _hyeonqyu_typed_router_core.RoutePathname<TMetadata, TContext, TRouteTree>>(pathname: TPath) =>
|
|
15
|
+
useCurrentRouteNode: <TPath extends _hyeonqyu_typed_router_core.RoutePathname<TMetadata, TContext, TRouteTree>>(pathname: TPath) => PathValue<TRouteTree, TPath, "/">;
|
|
14
16
|
_types: {
|
|
15
17
|
AppRoutesMetadata: TMetadata;
|
|
16
18
|
AppRoutesContext: TContext;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyeonqyu/typed-router-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Type-safe IA-first routing for React Router",
|
|
5
5
|
"author": "hyeonQyu <dhk0561@naver.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/hyeonQyu/typed-
|
|
9
|
+
"url": "https://github.com/hyeonQyu/typed-router.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/hyeonQyu/typed-
|
|
11
|
+
"homepage": "https://github.com/hyeonQyu/typed-router#readme",
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/hyeonQyu/typed-
|
|
13
|
+
"url": "https://github.com/hyeonQyu/typed-router/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"react",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react-router-dom": "^6.0.0 || ^7.0.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@hyeonqyu/typed-router-core": "
|
|
53
|
+
"@hyeonqyu/typed-router-core": "^0.1.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "^19.2.5",
|
|
@@ -66,4 +66,4 @@
|
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|