@next-box/appsettings 0.0.6 → 0.0.7

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": "@next-box/appsettings",
3
3
  "description": "A configuration management library for TypeScript applications, inspired by .NET’s appsettings.json.",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "author": "miami-man",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/badbatch/next-box",
@@ -3,11 +3,9 @@ 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
- P extends SettingSectionPath<{
8
- [K in keyof AppSettingsSchema]: AppSettingsSchema[K];
9
- }>,
10
- >(path: P): Get<AppSettingsSchema, P> | undefined;
6
+ export function useAppSettings<P extends SettingSectionPath<AppSettingsSchema>>(
7
+ path: P,
8
+ ): Get<AppSettingsSchema, P> | undefined;
11
9
 
12
10
  export function useAppSettings<T extends object, P extends SettingSectionPath<T>>(path: P): Get<T, P> | undefined;
13
11
 
package/src/index.ts CHANGED
@@ -7,6 +7,5 @@ export type { AppSettings, ScopedSettings } from '#types/AppSettings.types.ts';
7
7
  export type { SettingPath, SettingSectionPath, SettingValue } from '#types/Config.types.ts';
8
8
 
9
9
  // Consumers can augment this interface through the package's public entry point.
10
- export interface AppSettingsSchema {
11
- readonly __appSettingsSchema?: never;
12
- }
10
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
11
+ export interface AppSettingsSchema {}
@@ -17,12 +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'>]: NonNullable<T[K]> extends
21
- Primitive | readonly Primitive[]
20
+ [K in Extract<keyof T, string>]: NonNullable<T[K]> extends Primitive | readonly Primitive[]
22
21
  ? never
23
22
  : NonNullable<T[K]> extends object
24
23
  ? K | `${K}.${SettingSectionPath<NonNullable<T[K]>, PreviousDepth[Depth]>}`
25
24
  : never;
26
- }[Exclude<Extract<keyof T, string>, '__appSettingsSchema'>];
25
+ }[Extract<keyof T, string>];
27
26
 
28
27
  export type SettingValue<T extends object, P extends SettingPath<T>> = Get<T, P>;