@next-box/appsettings 0.0.5 → 0.0.6
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/cjs/hooks/useAppSettings.cjs.map +1 -1
- package/dist/esm/hooks/useAppSettings.mjs.map +1 -1
- package/dist/types/cjs/hooks/useAppSettings.d.cts +3 -1
- package/dist/types/cjs/hooks/useAppSettings.d.cts.map +1 -1
- package/dist/types/cjs/types/Config.types.d.cts +1 -1
- package/dist/types/cjs/types/Config.types.d.cts.map +1 -1
- package/dist/types/esm/hooks/useAppSettings.d.ts +3 -1
- package/dist/types/esm/hooks/useAppSettings.d.ts.map +1 -1
- package/dist/types/esm/types/Config.types.d.ts +1 -1
- package/dist/types/esm/types/Config.types.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/hooks/useAppSettings.ts +5 -3
- package/src/types/Config.types.ts +4 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-box/appsettings",
|
|
3
3
|
"description": "A configuration management library for TypeScript applications, inspired by .NET’s appsettings.json.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
5
5
|
"author": "miami-man",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/badbatch/next-box",
|
|
@@ -3,9 +3,11 @@ import { type SettingSectionPath } from '#types/Config.types.ts';
|
|
|
3
3
|
import { type AppSettingsSchema } from '../index.ts';
|
|
4
4
|
import { useAppSettingsContext } from './useAppSettingsContext.ts';
|
|
5
5
|
|
|
6
|
-
export function useAppSettings<
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export function useAppSettings<
|
|
7
|
+
P extends SettingSectionPath<{
|
|
8
|
+
[K in keyof AppSettingsSchema]: AppSettingsSchema[K];
|
|
9
|
+
}>,
|
|
10
|
+
>(path: P): Get<AppSettingsSchema, P> | undefined;
|
|
9
11
|
|
|
10
12
|
export function useAppSettings<T extends object, P extends SettingSectionPath<T>>(path: P): Get<T, P> | undefined;
|
|
11
13
|
|
|
@@ -17,10 +17,11 @@ export type SettingPath<T extends object, Depth extends number = 5> = Depth exte
|
|
|
17
17
|
export type SettingSectionPath<T extends object, Depth extends number = 5> = Depth extends 0
|
|
18
18
|
? never
|
|
19
19
|
: {
|
|
20
|
-
[K in Exclude<Extract<keyof T, string>, '__appSettingsSchema'>]: T[K] extends
|
|
20
|
+
[K in Exclude<Extract<keyof T, string>, '__appSettingsSchema'>]: NonNullable<T[K]> extends
|
|
21
|
+
Primitive | readonly Primitive[]
|
|
21
22
|
? never
|
|
22
|
-
: T[K] extends object
|
|
23
|
-
? K | `${K}.${SettingSectionPath<T[K]
|
|
23
|
+
: NonNullable<T[K]> extends object
|
|
24
|
+
? K | `${K}.${SettingSectionPath<NonNullable<T[K]>, PreviousDepth[Depth]>}`
|
|
24
25
|
: never;
|
|
25
26
|
}[Exclude<Extract<keyof T, string>, '__appSettingsSchema'>];
|
|
26
27
|
|