justus 0.5.104 → 0.5.105

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/types.d.ts CHANGED
@@ -145,10 +145,14 @@ export interface Schema {
145
145
  export interface AdditionalProperties<V extends Validator | false> {
146
146
  [Symbol.justusAdditionalValidator]: V;
147
147
  }
148
+ /** Utility type to "prettify" a type */
149
+ type Prettify<T extends object> = {
150
+ [K in keyof T]: T[K];
151
+ } & {};
148
152
  /** Infer the type validated by a `Schema` */
149
- export type InferSchema<S> = S extends AdditionalProperties<Validator<infer V>> ? {
153
+ export type InferSchema<S> = S extends AdditionalProperties<Validator<infer V>> ? Prettify<{
150
154
  [key in string]: V;
151
- } & InferSchema2<S> : InferSchema2<S>;
155
+ } & InferSchema2<S>> : Prettify<InferSchema2<S>>;
152
156
  /** Infer the property types described by a `Schema` */
153
157
  export type InferSchema2<S> = {
154
158
  -readonly [key in keyof S as key extends string ? key : never]?: InferValidation<S[key]>;
@@ -156,9 +160,9 @@ export type InferSchema2<S> = {
156
160
  -readonly [key in keyof S as key extends string ? undefined extends InferValidation<S[key]> ? never : key : never]-?: InferValidation<S[key]>;
157
161
  };
158
162
  /** Infer the input type compatible with a `Schema` */
159
- export type InferInputSchema<S> = S extends AdditionalProperties<Validator<any, infer X>> ? {
163
+ export type InferInputSchema<S> = S extends AdditionalProperties<Validator<any, infer X>> ? Prettify<{
160
164
  [key in string]: X;
161
- } & InferInputSchema2<S> : InferInputSchema2<S>;
165
+ } & InferInputSchema2<S>> : Prettify<InferInputSchema2<S>>;
162
166
  /** Infer the input type of the properties described by a `Schema` */
163
167
  export type InferInputSchema2<S> = {
164
168
  -readonly [key in keyof S as key extends string ? key : never]?: InferInput<S[key]>;
@@ -169,3 +173,4 @@ export type InferInputSchema2<S> = {
169
173
  export type Branding<S extends string> = {
170
174
  [brand in `__brand_${S}`]: never;
171
175
  };
176
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "justus",
3
- "version": "0.5.104",
3
+ "version": "0.5.105",
4
4
  "description": "A JavaScript validation library, with types!",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -89,7 +89,7 @@
89
89
  "license": "Apache-2.0",
90
90
  "devDependencies": {
91
91
  "@plugjs/build": "^0.6.70",
92
- "@plugjs/tsd": "^0.6.78",
92
+ "@plugjs/tsd": "^0.6.79",
93
93
  "typescript": "^5.9.3"
94
94
  },
95
95
  "directories": {
package/src/types.ts CHANGED
@@ -263,11 +263,14 @@ export interface AdditionalProperties<V extends Validator | false> {
263
263
  * INFER OBJECT TYPE FROM SCHEMA *
264
264
  * ========================================================================== */
265
265
 
266
+ /** Utility type to "prettify" a type */
267
+ type Prettify<T extends object> = { [ K in keyof T ]: T[K] } & {}
268
+
266
269
  /** Infer the type validated by a `Schema` */
267
270
  export type InferSchema<S> =
268
271
  S extends AdditionalProperties<Validator<infer V>> ?
269
- { [ key in string ] : V } & InferSchema2<S> :
270
- InferSchema2<S>
272
+ Prettify<{ [ key in string ] : V } & InferSchema2<S>> :
273
+ Prettify<InferSchema2<S>>
271
274
 
272
275
  /** Infer the property types described by a `Schema` */
273
276
  export type InferSchema2<S> = {
@@ -290,8 +293,8 @@ export type InferSchema2<S> = {
290
293
  /** Infer the input type compatible with a `Schema` */
291
294
  export type InferInputSchema<S> =
292
295
  S extends AdditionalProperties<Validator<any, infer X>> ?
293
- { [ key in string ] : X } & InferInputSchema2<S> :
294
- InferInputSchema2<S>
296
+ Prettify<{ [ key in string ] : X } & InferInputSchema2<S>> :
297
+ Prettify<InferInputSchema2<S>>
295
298
 
296
299
  /** Infer the input type of the properties described by a `Schema` */
297
300
  export type InferInputSchema2<S> = {