ts-fortress 6.4.1 → 6.4.2
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/compose/index.d.mts +0 -1
- package/dist/compose/index.d.mts.map +1 -1
- package/dist/compose/index.mjs +0 -1
- package/dist/compose/index.mjs.map +1 -1
- package/dist/entry-point.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/record/index.d.mts +1 -0
- package/dist/record/index.d.mts.map +1 -1
- package/dist/record/index.mjs +1 -0
- package/dist/record/index.mjs.map +1 -1
- package/dist/record/keyof.d.mts +4 -4
- package/dist/record/keyof.d.mts.map +1 -1
- package/dist/record/keyof.mjs.map +1 -1
- package/dist/record/merge-records.d.mts +35 -0
- package/dist/record/merge-records.d.mts.map +1 -0
- package/dist/record/merge-records.mjs +20 -0
- package/dist/record/merge-records.mjs.map +1 -0
- package/dist/record/omit.d.mts +3 -3
- package/dist/record/omit.d.mts.map +1 -1
- package/dist/record/omit.mjs.map +1 -1
- package/dist/record/partial.d.mts +6 -6
- package/dist/record/partial.d.mts.map +1 -1
- package/dist/record/partial.mjs.map +1 -1
- package/dist/record/pick.d.mts +3 -3
- package/dist/record/pick.d.mts.map +1 -1
- package/dist/record/pick.mjs.map +1 -1
- package/dist/record/record.d.mts +3 -3
- package/dist/record/record.d.mts.map +1 -1
- package/dist/record/record.mjs.map +1 -1
- package/dist/record/required.d.mts +6 -6
- package/dist/record/required.d.mts.map +1 -1
- package/dist/record/required.mjs.map +1 -1
- package/dist/record/valueof.d.mts +4 -4
- package/dist/record/valueof.d.mts.map +1 -1
- package/dist/record/valueof.mjs.map +1 -1
- package/dist/type.d.mts +2 -1
- package/dist/type.d.mts.map +1 -1
- package/package.json +13 -13
- package/src/compose/index.mts +0 -1
- package/src/other-types/recursion.test.mts +2 -1
- package/src/record/index.mts +1 -0
- package/src/record/keyof.mts +5 -7
- package/src/record/merge-records.mts +348 -0
- package/src/{compose → record}/merge-records.options.test.mts +1 -15
- package/src/record/merge-records.test.mts +307 -0
- package/src/record/omit.mts +3 -2
- package/src/record/partial.mts +9 -10
- package/src/record/pick.mts +3 -2
- package/src/record/record-strict-composition.test.mts +32 -46
- package/src/record/record.mts +3 -4
- package/src/record/required.mts +9 -10
- package/src/record/valueof.mts +4 -6
- package/src/type.mts +3 -1
- package/dist/compose/merge-records.d.mts +0 -15
- package/dist/compose/merge-records.d.mts.map +0 -1
- package/dist/compose/merge-records.mjs +0 -61
- package/dist/compose/merge-records.mjs.map +0 -1
- package/src/compose/merge-records.mts +0 -252
- package/src/compose/merge-records.test.mts +0 -160
package/dist/compose/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/compose/index.mts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/compose/index.mts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
|
package/dist/compose/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/entry-point.mjs
CHANGED
|
@@ -8,7 +8,6 @@ export { brand } from './brand/brand.mjs';
|
|
|
8
8
|
export { brandedNumber, simpleBrandedNumber } from './brand/branded-number.mjs';
|
|
9
9
|
export { brandedString, simpleBrandedString } from './brand/branded-string.mjs';
|
|
10
10
|
export { intersection } from './compose/intersection.mjs';
|
|
11
|
-
export { mergeRecords } from './compose/merge-records.mjs';
|
|
12
11
|
export { union } from './compose/union.mjs';
|
|
13
12
|
export { enumType } from './enum/enum.mjs';
|
|
14
13
|
export { intRange } from './enum/int-range.mjs';
|
|
@@ -53,6 +52,7 @@ export { symbol } from './primitives/symbol.mjs';
|
|
|
53
52
|
export { undefinedType } from './primitives/undefined.mjs';
|
|
54
53
|
export { keyValueRecord } from './record/key-value-record.mjs';
|
|
55
54
|
export { keyof } from './record/keyof.mjs';
|
|
55
|
+
export { mergeRecords } from './record/merge-records.mjs';
|
|
56
56
|
export { omit } from './record/omit.mjs';
|
|
57
57
|
export { isOptionalProperty, optional } from './record/optional.mjs';
|
|
58
58
|
export { partial } from './record/partial.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,6 @@ export { brand } from './brand/brand.mjs';
|
|
|
7
7
|
export { brandedNumber, simpleBrandedNumber } from './brand/branded-number.mjs';
|
|
8
8
|
export { brandedString, simpleBrandedString } from './brand/branded-string.mjs';
|
|
9
9
|
export { intersection } from './compose/intersection.mjs';
|
|
10
|
-
export { mergeRecords } from './compose/merge-records.mjs';
|
|
11
10
|
export { union } from './compose/union.mjs';
|
|
12
11
|
export { enumType } from './enum/enum.mjs';
|
|
13
12
|
export { intRange } from './enum/int-range.mjs';
|
|
@@ -52,6 +51,7 @@ export { symbol } from './primitives/symbol.mjs';
|
|
|
52
51
|
export { undefinedType } from './primitives/undefined.mjs';
|
|
53
52
|
export { keyValueRecord } from './record/key-value-record.mjs';
|
|
54
53
|
export { keyof } from './record/keyof.mjs';
|
|
54
|
+
export { mergeRecords } from './record/merge-records.mjs';
|
|
55
55
|
export { omit } from './record/omit.mjs';
|
|
56
56
|
export { isOptionalProperty, optional } from './record/optional.mjs';
|
|
57
57
|
export { partial } from './record/partial.mjs';
|
package/dist/record/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/record/index.mts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/record/index.mts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
package/dist/record/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { keyValueRecord } from './key-value-record.mjs';
|
|
2
2
|
export { keyof } from './keyof.mjs';
|
|
3
|
+
export { mergeRecords } from './merge-records.mjs';
|
|
3
4
|
export { omit } from './omit.mjs';
|
|
4
5
|
export { isOptionalProperty, optional } from './optional.mjs';
|
|
5
6
|
export { partial } from './partial.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
package/dist/record/keyof.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type RecordType, type Type } from '../type.mjs';
|
|
2
|
-
export declare const keyof: <const R extends
|
|
1
|
+
import { type RecordType, type Type, type UnknownShape } from '../type.mjs';
|
|
2
|
+
export declare const keyof: <const R extends UnknownShape>(recordType: RecordType<R>, options?: Partial<Readonly<{
|
|
3
3
|
typeName: string;
|
|
4
4
|
}>>) => KeyofType<R>;
|
|
5
|
-
type KeyofTypeSub<R extends
|
|
6
|
-
type KeyofType<R extends
|
|
5
|
+
type KeyofTypeSub<R extends UnknownShape> = Type<ToString<keyof R>>;
|
|
6
|
+
type KeyofType<R extends UnknownShape> = IsNever<keyof R> extends true ? Type<undefined> : KeyofTypeSub<R>;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=keyof.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyof.d.mts","sourceRoot":"","sources":["../../src/record/keyof.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"keyof.d.mts","sourceRoot":"","sources":["../../src/record/keyof.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,KAAK,GAAI,KAAK,CAAC,CAAC,SAAS,YAAY,EAChD,YAAY,UAAU,CAAC,CAAC,CAAC,EACzB,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CACH,KACA,SAAS,CAAC,CAAC,CAQW,CAAC;AAY1B,KAAK,YAAY,CAAC,CAAC,SAAS,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEpE,KAAK,SAAS,CAAC,CAAC,SAAS,YAAY,IACnC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyof.mjs","sources":["../../src/record/keyof.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAKa,KAAK,GAAG,CACnB,UAAyB,EACzB,OAIC;AAED;AACA,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KACjC,GAAG,CAAC,UAAU,CAAC,IAAI;AACjB,MAAG,QAAQ,CAAC,IAAI,EAAE;QACd,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAA,MAAA,EAAS,UAAU,CAAC,QAAQ,CAAA,CAAE;KAC9D;AACH,MAAG,aAAwC,CAC9C,CAAC;AAEJ,MAAM,OAAO,GAAG,CACd,UAAyB;AAEzB;AACA,MAAM,CAAC,IAAI,CACT,UAAU,CAAC,KAAK,CAGf;
|
|
1
|
+
{"version":3,"file":"keyof.mjs","sources":["../../src/record/keyof.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAKa,KAAK,GAAG,CACnB,UAAyB,EACzB,OAIC;AAED;AACA,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KACjC,GAAG,CAAC,UAAU,CAAC,IAAI;AACjB,MAAG,QAAQ,CAAC,IAAI,EAAE;QACd,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAA,MAAA,EAAS,UAAU,CAAC,QAAQ,CAAA,CAAE;KAC9D;AACH,MAAG,aAAwC,CAC9C,CAAC;AAEJ,MAAM,OAAO,GAAG,CACd,UAAyB;AAEzB;AACA,MAAM,CAAC,IAAI,CACT,UAAU,CAAC,KAAK,CAGf;AAOL;AAOA;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ExcessPropertyBehavior, type ExcessPropertyFillBehavior, type RecordType, type TypeOf, type UnknownShape } from '../type.mjs';
|
|
2
|
+
type UnknownRecordType = RecordType<UnknownShape, ExcessPropertyBehavior>;
|
|
3
|
+
export declare const mergeRecords: <const RecordTypes extends NonEmptyArray<UnknownRecordType>, const ExcessValidation extends ExcessPropertyBehavior = "strip">(recordTypes: RecordTypes, options?: Partial<Readonly<{
|
|
4
|
+
typeName: string;
|
|
5
|
+
defaultValue: IntersectionTypeValue<RecordTypes>;
|
|
6
|
+
/**
|
|
7
|
+
* Behavior when validating objects with excess properties.
|
|
8
|
+
* - 'allow': Accept excess properties
|
|
9
|
+
* - 'strip': Remove excess properties from the result (default)
|
|
10
|
+
* - 'error': Reject objects with excess properties
|
|
11
|
+
* @default 'strip'
|
|
12
|
+
*/
|
|
13
|
+
excessPropertyValidation: ExcessValidation;
|
|
14
|
+
/**
|
|
15
|
+
* Behavior when filling objects with excess properties.
|
|
16
|
+
* - 'allow': Keep excess properties in the result
|
|
17
|
+
* - 'strip': Remove excess properties from the result (default)
|
|
18
|
+
* @default 'strip'
|
|
19
|
+
*/
|
|
20
|
+
excessPropertyFill: ExcessPropertyFillBehavior;
|
|
21
|
+
}>>) => RecordType<TsFortressInternal.CastToShape<IntersectionOfTypeShape<RecordTypes>>, ExcessValidation>;
|
|
22
|
+
type IntersectionTypeValue<Types extends NonEmptyArray<UnknownRecordType>> = Intersection<TsFortressInternal.TypeListToValueTypeList<Types>>;
|
|
23
|
+
type IntersectionOfTypeShape<Types extends NonEmptyArray<UnknownRecordType>> = Intersection<TsFortressInternal.TypeListToShapeList<Types>>;
|
|
24
|
+
declare namespace TsFortressInternal {
|
|
25
|
+
export type TypeListToValueTypeList<Types extends readonly UnknownRecordType[]> = TypeListToValueTypeListImpl<Types>;
|
|
26
|
+
type TypeListToValueTypeListImpl<Types extends readonly unknown[]> = Types extends readonly [] ? readonly [] : Types extends readonly [infer Head, ...infer Tail] ? readonly [TypeOf<Cast1<Head>>, ...TypeListToValueTypeListImpl<Tail>] : never;
|
|
27
|
+
type Cast1<T> = [T] extends [UnknownRecordType] ? T : never;
|
|
28
|
+
export type TypeListToShapeList<Types extends readonly UnknownRecordType[]> = TypeListToShapeListImpl<Types>;
|
|
29
|
+
type TypeListToShapeListImpl<Types extends readonly unknown[]> = Types extends readonly [] ? readonly [] : Types extends readonly [infer Head, ...infer Tail] ? readonly [GetShape<Head>, ...TypeListToShapeListImpl<Tail>] : never;
|
|
30
|
+
type GetShape<T> = [T] extends [UnknownRecordType] ? T['shape'] : never;
|
|
31
|
+
export type CastToShape<T> = [T] extends [UnknownShape] ? T : never;
|
|
32
|
+
export {};
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=merge-records.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-records.d.mts","sourceRoot":"","sources":["../../src/record/merge-records.mts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,UAAU,EAEf,KAAK,MAAM,EACX,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAIrB,KAAK,iBAAiB,GAAG,UAAU,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;AAE1E,eAAO,MAAM,YAAY,GACvB,KAAK,CAAC,WAAW,SAAS,aAAa,CAAC,iBAAiB,CAAC,EAC1D,KAAK,CAAC,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,EAE/D,aAAa,WAAW,EACxB,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,wBAAwB,EAAE,gBAAgB,CAAC;IAE3C;;;;;OAKG;IACH,kBAAkB,EAAE,0BAA0B,CAAC;CAChD,CAAC,CACH,KACA,UAAU,CACX,kBAAkB,CAAC,WAAW,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,EACpE,gBAAgB,CAqBjB,CAAC;AAMF,KAAK,qBAAqB,CAAC,KAAK,SAAS,aAAa,CAAC,iBAAiB,CAAC,IACvE,YAAY,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC;AAElE,KAAK,uBAAuB,CAAC,KAAK,SAAS,aAAa,CAAC,iBAAiB,CAAC,IACzE,YAAY,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC;AAE9D,kBAAU,kBAAkB,CAAC;IAC3B,MAAM,MAAM,uBAAuB,CACjC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mjs';
|
|
3
|
+
import '../other-types/unknown.mjs';
|
|
4
|
+
import { record } from './record.mjs';
|
|
5
|
+
|
|
6
|
+
const mergeRecords = (recordTypes, options) => {
|
|
7
|
+
const typeNameFilled = options?.typeName ??
|
|
8
|
+
`(${toIntersectionString(recordTypes.map((a) => a.typeName))})`;
|
|
9
|
+
const shapes = Arr.map(recordTypes, (t) => t.shape);
|
|
10
|
+
const mergedShape = Obj.merge(...shapes);
|
|
11
|
+
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
12
|
+
return record(mergedShape, {
|
|
13
|
+
typeName: typeNameFilled,
|
|
14
|
+
excessPropertyValidation: options?.excessPropertyValidation,
|
|
15
|
+
excessPropertyFill: options?.excessPropertyFill,
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { mergeRecords };
|
|
20
|
+
//# sourceMappingURL=merge-records.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-records.mjs","sources":["../../src/record/merge-records.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAea,YAAY,GAAG,CAI1B,WAAwB,EACxB,OAsBC,KAIC;AAMF,IAAA,MAAM,cAAc,GAClB,OAAO,EAAE,QAAQ;AACjB,QAAA,CAAA,CAAA,EAAI,oBAAoB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG;AAEjE,IAAA,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;IAEnD,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;;IAGxC,OAAO,MAAM,CAAC,WAA2B,EAAE;AACzC,QAAA,QAAQ,EAAE,cAAc;QACxB,wBAAwB,EAAE,OAAO,EAAE,wBAAwB;QAC3D,kBAAkB,EAAE,OAAO,EAAE,kBAAkB;AAChD,KAAA,CAAmB;AACtB;;;;"}
|
package/dist/record/omit.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type ExcessPropertyBehavior, type RecordType, type
|
|
1
|
+
import { type ExcessPropertyBehavior, type RecordType, type UnknownShape } from '../type.mjs';
|
|
2
2
|
/** Creates a record type with keys omitted. */
|
|
3
|
-
export declare const omit: <const R extends
|
|
3
|
+
export declare const omit: <const R extends UnknownShape, const KeysToOmit extends readonly (keyof R & string)[], const ExcessValidation extends ExcessPropertyBehavior = "strip">(recordType: RecordType<R, ExcessValidation>, keysToOmit: KeysToOmit, options?: Partial<Readonly<{
|
|
4
4
|
typeName: string;
|
|
5
5
|
excessPropertyValidation: ExcessValidation;
|
|
6
6
|
excessPropertyFill: Extract<ExcessPropertyBehavior, "allow" | "strip">;
|
|
7
7
|
}>>) => OmittedType<R, KeysToOmit, ExcessValidation>;
|
|
8
|
-
export type OmittedType<R extends
|
|
8
|
+
export type OmittedType<R extends UnknownShape, KeysToOmit extends readonly (keyof R)[], ExcessValidation extends ExcessPropertyBehavior = 'strip'> = RecordType<Omit<R, ArrayElement<KeysToOmit>>, ExcessValidation>;
|
|
9
9
|
//# sourceMappingURL=omit.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.d.mts","sourceRoot":"","sources":["../../src/record/omit.mts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"omit.d.mts","sourceRoot":"","sources":["../../src/record/omit.mts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAEf,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAIrB,+CAA+C;AAC/C,eAAO,MAAM,IAAI,GACf,KAAK,CAAC,CAAC,SAAS,YAAY,EAC5B,KAAK,CAAC,UAAU,SAAS,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EACtD,KAAK,CAAC,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,EAE/D,YAAY,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAC3C,YAAY,UAAU,EACtB,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,gBAAgB,CAAC;IAC3C,kBAAkB,EAAE,OAAO,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC;CACxE,CAAC,CACH,KACA,WAAW,CAAC,CAAC,EAAE,UAAU,EAAE,gBAAgB,CAS1C,CAAC;AAEL,MAAM,MAAM,WAAW,CACrB,CAAC,SAAS,YAAY,EACtB,UAAU,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EACvC,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,IACvD,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC"}
|
package/dist/record/omit.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"omit.mjs","sources":["../../src/record/omit.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"omit.mjs","sources":["../../src/record/omit.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAUA;AACO,MAAM,IAAI,GAAG,CAKlB,UAA2C,EAC3C,UAAsB,EACtB,OAMC,KAED,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE;IAC7C,QAAQ,EACN,OAAO,EAAE,QAAQ;QACjB,CAAA,KAAA,EAAQ,UAAU,CAAC,QAAQ,CAAA,EAAA,EAAK,gBAAgB,CAAC,UAAU,CAAC,CAAA,CAAA,CAAG;AACjE,IAAA,wBAAwB,EACtB,OAAO,EAAE,wBAAwB,IAAI,UAAU,CAAC,wBAAwB;AAC1E,IAAA,kBAAkB,EAChB,OAAO,EAAE,kBAAkB,IAAI,UAAU,CAAC,kBAAkB;AAC/D,CAAA;;;;"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { type ExcessPropertyBehavior, type RecordType, type
|
|
1
|
+
import { type ExcessPropertyBehavior, type RecordType, type UnknownShape } from '../type.mjs';
|
|
2
2
|
import { type OptionalPropertyType } from './optional.mjs';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Partial type. If keysToBeOptional is set, only those keys are
|
|
5
5
|
* optional, otherwise, all properties are optional.
|
|
6
6
|
*/
|
|
7
|
-
export declare const partial: <const R extends
|
|
7
|
+
export declare const partial: <const R extends UnknownShape, const KeysToBeOptional extends NonEmptyArray<keyof R & string>, const ExcessValidation extends ExcessPropertyBehavior = "strip">(recordType: RecordType<R, ExcessValidation>, options?: Partial<Readonly<{
|
|
8
8
|
keysToBeOptional: KeysToBeOptional;
|
|
9
9
|
typeName: string;
|
|
10
10
|
excessPropertyValidation: ExcessValidation;
|
|
11
11
|
excessPropertyFill: Extract<ExcessPropertyBehavior, "allow" | "strip">;
|
|
12
12
|
}>>) => PartialType<R, KeysToBeOptional, ExcessValidation>;
|
|
13
|
-
type PartialTypeShape<R extends
|
|
14
|
-
type FullyOptionalType<R extends
|
|
13
|
+
type PartialTypeShape<R extends UnknownShape, KeysToBeOptional extends NonEmptyArray<keyof R & string> | undefined> = TypeEq<KeysToBeOptional, undefined> extends true ? FullyOptionalType<R> : PartiallyOptionalType<R, ArrayElement<KeysToBeOptional>>;
|
|
14
|
+
type FullyOptionalType<R extends UnknownShape> = Readonly<{
|
|
15
15
|
[P in keyof R]: OptionalPropertyType<R[P]>;
|
|
16
16
|
}>;
|
|
17
|
-
type PartiallyOptionalType<R extends
|
|
17
|
+
type PartiallyOptionalType<R extends UnknownShape, K extends keyof R> = Readonly<{
|
|
18
18
|
[P in keyof R]: P extends K ? OptionalPropertyType<R[P]> : R[P];
|
|
19
19
|
}>;
|
|
20
|
-
export type PartialType<R extends
|
|
20
|
+
export type PartialType<R extends UnknownShape, KeysToBeOptional extends NonEmptyArray<keyof R & string> | undefined, ExcessValidation extends ExcessPropertyBehavior = 'strip'> = RecordType<PartialTypeShape<R, KeysToBeOptional>, ExcessValidation>;
|
|
21
21
|
export {};
|
|
22
22
|
//# sourceMappingURL=partial.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial.d.mts","sourceRoot":"","sources":["../../src/record/partial.mts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"partial.d.mts","sourceRoot":"","sources":["../../src/record/partial.mts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAEf,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGrE;;;GAGG;AACH,eAAO,MAAM,OAAO,GAClB,KAAK,CAAC,CAAC,SAAS,YAAY,EAC5B,KAAK,CAAC,gBAAgB,SAAS,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAC9D,KAAK,CAAC,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,EAE/D,YAAY,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAC3C,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,gBAAgB,CAAC;IAC3C,kBAAkB,EAAE,OAAO,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC;CACxE,CAAC,CACH,KACA,WAAW,CAAC,CAAC,EAAE,gBAAgB,EAAE,gBAAgB,CA0BnD,CAAC;AAEF,KAAK,gBAAgB,CACnB,CAAC,SAAS,YAAY,EACtB,gBAAgB,SAAS,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS,IAEpE,MAAM,CAAC,gBAAgB,EAAE,SAAS,CAAC,SAAS,IAAI,GAC5C,iBAAiB,CAAC,CAAC,CAAC,GACpB,qBAAqB,CAAC,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAE/D,KAAK,iBAAiB,CAAC,CAAC,SAAS,YAAY,IAAI,QAAQ,CAAC;KACvD,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAC,CAAC;AAEH,KAAK,qBAAqB,CACxB,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,MAAM,CAAC,IACf,QAAQ,CAAC;KACV,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC,CAAC;AAEH,MAAM,MAAM,WAAW,CACrB,CAAC,SAAS,YAAY,EACtB,gBAAgB,SAAS,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS,EACpE,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,IACvD,UAAU,CAAC,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partial.mjs","sources":["../../src/record/partial.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"partial.mjs","sources":["../../src/record/partial.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAWA;;;AAGG;MACU,OAAO,GAAG,CAKrB,UAA2C,EAC3C,OAOC,KACqD;AACtD,IAAA,MAAM,cAAc,GAClB,OAAO,EAAE,QAAQ;AACjB,SAAC,OAAO,EAAE,gBAAgB,KAAK;AAC7B,cAAE,CAAA,QAAA,EAAW,UAAU,CAAC,QAAQ,CAAA,CAAA;AAChC,cAAE,CAAA,iBAAA,EAAoB,UAAU,CAAC,QAAQ,CAAA,EAAA,EAAK,gBAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA,CAAA,CAAG,CAAC;AAEhG,IAAA,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CACnD,OAAO,EAAE,gBAAgB,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAC3D;AAED,IAAA,MAAM,YAAY;;IAEhB,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAClC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAU,CACpE,CAC8D;IAEnE,OAAO,MAAM,CAAC,YAAY,EAAE;AAC1B,QAAA,QAAQ,EAAE,cAAc;AACxB,QAAA,wBAAwB,EACtB,OAAO,EAAE,wBAAwB,IAAI,UAAU,CAAC,wBAAwB;AAC1E,QAAA,kBAAkB,EAChB,OAAO,EAAE,kBAAkB,IAAI,UAAU,CAAC,kBAAkB;AAC/D,KAAA,CAAC;AACJ;;;;"}
|
package/dist/record/pick.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type ExcessPropertyBehavior, type RecordType, type
|
|
1
|
+
import { type ExcessPropertyBehavior, type RecordType, type UnknownShape } from '../type.mjs';
|
|
2
2
|
/** Creates a record type with keys picked. */
|
|
3
|
-
export declare const pick: <const R extends
|
|
3
|
+
export declare const pick: <const R extends UnknownShape, const KeysToPick extends readonly (keyof R & string)[], const ExcessValidation extends ExcessPropertyBehavior = "strip">(recordType: RecordType<R, ExcessValidation>, keysToPick: KeysToPick, options?: Partial<Readonly<{
|
|
4
4
|
typeName: string;
|
|
5
5
|
excessPropertyValidation: ExcessValidation;
|
|
6
6
|
excessPropertyFill: Extract<ExcessPropertyBehavior, "allow" | "strip">;
|
|
7
7
|
}>>) => PickedType<R, KeysToPick, ExcessValidation>;
|
|
8
|
-
export type PickedType<R extends
|
|
8
|
+
export type PickedType<R extends UnknownShape, KeysToPick extends readonly (keyof R)[], ExcessValidation extends ExcessPropertyBehavior = 'strip'> = RecordType<Pick<R, ArrayElement<KeysToPick>>, ExcessValidation>;
|
|
9
9
|
//# sourceMappingURL=pick.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.d.mts","sourceRoot":"","sources":["../../src/record/pick.mts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"pick.d.mts","sourceRoot":"","sources":["../../src/record/pick.mts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAEf,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAIrB,8CAA8C;AAC9C,eAAO,MAAM,IAAI,GACf,KAAK,CAAC,CAAC,SAAS,YAAY,EAC5B,KAAK,CAAC,UAAU,SAAS,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EACtD,KAAK,CAAC,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,EAE/D,YAAY,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAC3C,YAAY,UAAU,EACtB,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,gBAAgB,CAAC;IAC3C,kBAAkB,EAAE,OAAO,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC;CACxE,CAAC,CACH,KACA,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,gBAAgB,CASzC,CAAC;AAEL,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,YAAY,EACtB,UAAU,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EACvC,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,IACvD,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC"}
|
package/dist/record/pick.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.mjs","sources":["../../src/record/pick.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"pick.mjs","sources":["../../src/record/pick.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAUA;AACO,MAAM,IAAI,GAAG,CAKlB,UAA2C,EAC3C,UAAsB,EACtB,OAMC,KAED,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE;IAC7C,QAAQ,EACN,OAAO,EAAE,QAAQ;QACjB,CAAA,KAAA,EAAQ,UAAU,CAAC,QAAQ,CAAA,EAAA,EAAK,gBAAgB,CAAC,UAAU,CAAC,CAAA,CAAA,CAAG;AACjE,IAAA,wBAAwB,EACtB,OAAO,EAAE,wBAAwB,IAAI,UAAU,CAAC,wBAAwB;AAC1E,IAAA,kBAAkB,EAChB,OAAO,EAAE,kBAAkB,IAAI,UAAU,CAAC,kBAAkB;AAC/D,CAAA;;;;"}
|
package/dist/record/record.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ExcessPropertyBehavior, type ExcessPropertyFillBehavior, type RecordType, type
|
|
2
|
-
export declare const record: <const R extends
|
|
1
|
+
import { type ExcessPropertyBehavior, type ExcessPropertyFillBehavior, type RecordType, type UnknownShape } from '../type.mjs';
|
|
2
|
+
export declare const record: <const R extends UnknownShape, const ExcessValidation extends ExcessPropertyBehavior = "strip">(shape: R, options?: Partial<Readonly<{
|
|
3
3
|
typeName: string;
|
|
4
4
|
/**
|
|
5
5
|
* Behavior when validating objects with excess properties.
|
|
@@ -38,7 +38,7 @@ export declare const record: <const R extends ReadonlyRecord<string, Type<unknow
|
|
|
38
38
|
* User.is({ name: "John", age: 30, extra: "not allowed" }); // false
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
export declare const strictRecord: <const R extends
|
|
41
|
+
export declare const strictRecord: <const R extends UnknownShape>(source: R, options?: Partial<Readonly<{
|
|
42
42
|
typeName: string;
|
|
43
43
|
excessPropertyFill: Extract<ExcessPropertyBehavior, "allow" | "strip">;
|
|
44
44
|
}>>) => RecordType<R, "error">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.mts","sourceRoot":"","sources":["../../src/record/record.mts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"record.d.mts","sourceRoot":"","sources":["../../src/record/record.mts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,UAAU,EAGf,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAUrB,eAAO,MAAM,MAAM,GACjB,KAAK,CAAC,CAAC,SAAS,YAAY,EAC5B,KAAK,CAAC,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,EAE/D,OAAO,CAAC,EACR,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,wBAAwB,EAAE,gBAAgB,CAAC;IAE3C;;;;;OAKG;IACH,kBAAkB,EAAE,0BAA0B,CAAC;CAChD,CAAC,CACH,KACA,UAAU,CAAC,CAAC,EAAE,gBAAgB,CA8LhC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,CAAC,CAAC,SAAS,YAAY,EACvD,QAAQ,CAAC,EACT,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC;CACxE,CAAC,CACH,KACA,UAAU,CAAC,CAAC,EAAE,OAAO,CAC2C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.mjs","sources":["../../src/record/record.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"record.mjs","sources":["../../src/record/record.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;MAyBa,MAAM,GAAG,CAIpB,KAAQ,EACR,OAqBC,KACkC;AAKnC,IAAA,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE9C,IAAA,MAAM,cAAc,GAClB,OAAO,EAAE,QAAQ;AACjB,QAAA,CAAA,EAAA,EAAK,MAAM,CAAC,OAAO,CAAC,KAAK;AACtB,aAAA,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAA,EAAA,EAAK,CAAC,CAAC,QAAQ,EAAE;AACrC,aAAA,IAAI,CAAC,IAAI,CAAC,CAAA,EAAA,CAAI;AAEnB,IAAA,MAAM,wBAAwB,GAAG,OAAO,EAAE,wBAAwB,IAAI,OAAO;AAE7E,IAAA,MAAM,kBAAkB,GAAG,OAAO,EAAE,kBAAkB,IAAI,OAAO;AAEjE,IAAA,MAAM,eAAe,GAAG,eAAe,CACrC;;AAEE,IAAA,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KACrC,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,CAC5B,CACG,CACT;AAED,IAAA,MAAM,qBAAqB,GAAG,CAAC,GAAoC;;IAEjE,MA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AAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AAChB,wBAAA,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;;wBAGlB,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AAC9C,4BAAA,OAAO,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC;wBACzB;wBAEA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBAC7B;oBAEA,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC;gBAC9B,CAAC,CAAC,CACE;YACR;;AAEJ,IAAA,CAAC;IAED,OAAO;AACL,QAAA,QAAQ,EAAE,cAAc;AACxB,QAAA,IAAI,YAAY,GAAA;YACd,OAAO,eAAe,EAAE;QAC1B,CAAC;QACD,IAAI;QACJ,QAAQ;AACR,QAAA,EAAE,EAAE,UAAU,CAAC,QAAQ,CAAC;AACxB,QAAA,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,QAAA,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC;QAC5B,KAAK;;AAEL,QAAA,wBAAwB,EAAE,wBAA4C;QACtE,kBAAkB;KACnB;AACH;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,YAAY,GAAG,CAC1B,MAAS,EACT,OAKC,KAED,MAAM,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE;;;;"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { type ExcessPropertyBehavior, type RecordType, type
|
|
1
|
+
import { type ExcessPropertyBehavior, type RecordType, type UnknownShape } from '../type.mjs';
|
|
2
2
|
import { type RequiredPropertyType } from './optional.mjs';
|
|
3
3
|
/**
|
|
4
4
|
* Creates a Required type. If keysToBeRequired is set, only those keys are
|
|
5
5
|
* made required, otherwise, all properties are made required.
|
|
6
6
|
*/
|
|
7
|
-
export declare const required: <const R extends
|
|
7
|
+
export declare const required: <const R extends UnknownShape, const KeysToBeRequired extends NonEmptyArray<keyof R & string>, const ExcessValidation extends ExcessPropertyBehavior = "strip">(recordType: RecordType<R, ExcessValidation>, options?: Partial<Readonly<{
|
|
8
8
|
keysToBeRequired: KeysToBeRequired;
|
|
9
9
|
typeName: string;
|
|
10
10
|
excessPropertyValidation: ExcessValidation;
|
|
11
11
|
excessPropertyFill: Extract<ExcessPropertyBehavior, "allow" | "strip">;
|
|
12
12
|
}>>) => RequiredType<R, KeysToBeRequired, ExcessValidation>;
|
|
13
|
-
type RequiredTypeShape<R extends
|
|
14
|
-
type FullyRequiredType<R extends
|
|
13
|
+
type RequiredTypeShape<R extends UnknownShape, KeysToBeRequired extends NonEmptyArray<keyof R & string> | undefined> = TypeEq<KeysToBeRequired, undefined> extends true ? FullyRequiredType<R> : PartiallyRequiredType<R, ArrayElement<KeysToBeRequired>>;
|
|
14
|
+
type FullyRequiredType<R extends UnknownShape> = Readonly<{
|
|
15
15
|
[P in keyof R]: RequiredPropertyType<R[P]>;
|
|
16
16
|
}>;
|
|
17
|
-
type PartiallyRequiredType<R extends
|
|
17
|
+
type PartiallyRequiredType<R extends UnknownShape, K extends keyof R> = Readonly<{
|
|
18
18
|
[P in keyof R]: P extends K ? RequiredPropertyType<R[P]> : R[P];
|
|
19
19
|
}>;
|
|
20
|
-
export type RequiredType<R extends
|
|
20
|
+
export type RequiredType<R extends UnknownShape, KeysToBeRequired extends NonEmptyArray<keyof R & string> | undefined, ExcessValidation extends ExcessPropertyBehavior = 'strip'> = RecordType<RequiredTypeShape<R, KeysToBeRequired>, ExcessValidation>;
|
|
21
21
|
export {};
|
|
22
22
|
//# sourceMappingURL=required.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"required.d.mts","sourceRoot":"","sources":["../../src/record/required.mts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B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CAAC,CAAC;AAEH,KAAK,qBAAqB,CACxB,CAAC,SAAS,YAAY,EACtB,CAAC,SAAS,MAAM,CAAC,IACf,QAAQ,CAAC;KACV,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC,CAAC;AAEH,MAAM,MAAM,YAAY,CACtB,CAAC,SAAS,YAAY,EACtB,gBAAgB,SAAS,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS,EACpE,gBAAgB,SAAS,sBAAsB,GAAG,OAAO,IACvD,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"required.mjs","sources":["../../src/record/required.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"required.mjs","sources":["../../src/record/required.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAeA;;;AAGG;MACU,QAAQ,GAAG,CAKtB,UAA2C,EAC3C,OAOC,KACsD;AACvD,IAAA,MAAM,cAAc,GAClB,OAAO,EAAE,QAAQ;AACjB,SAAC,OAAO,EAAE,gBAAgB,KAAK;AAC7B,cAAE,CAAA,SAAA,EAAY,UAAU,CAAC,QAAQ,CAAA,CAAA;AACjC,cAAE,CAAA,kBAAA,EAAqB,UAAU,CAAC,QAAQ,CAAA,EAAA,EAAK,gBAAgB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA,CAAA,CAAG,CAAC;AAEjG,IAAA,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CACnD,OAAO,EAAE,gBAAgB,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAC3D;AAED,IAAA,MAAM,aAAa;;IAEjB,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAClC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAU,CACxE,CAC+D;IAEpE,OAAO,MAAM,CAAC,aAAa,EAAE;AAC3B,QAAA,QAAQ,EAAE,cAAc;AACxB,QAAA,wBAAwB,EACtB,OAAO,EAAE,wBAAwB,IAAI,UAAU,CAAC,wBAAwB;AAC1E,QAAA,kBAAkB,EAChB,OAAO,EAAE,kBAAkB,IAAI,UAAU,CAAC,kBAAkB;AAC/D,KAAA,CAAC;AACJ;AAEA;;AAEG;AACH,MAAM,YAAY,GAAG,CACnB,CAAI,KAEJ,kBAAkB,CAAC,CAAC;AAClB;QACG,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC;MACzB,CAAC;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type RecordType, type Type } from '../type.mjs';
|
|
2
|
-
export declare const valueof: <const R extends
|
|
1
|
+
import { type RecordType, type Type, type UnknownShape } from '../type.mjs';
|
|
2
|
+
export declare const valueof: <const R extends UnknownShape>(recordType: RecordType<R>, options?: Partial<Readonly<{
|
|
3
3
|
typeName: string;
|
|
4
4
|
}>>) => ValueOfType<R>;
|
|
5
|
-
type ValueofTypeSub<R extends
|
|
6
|
-
type ValueOfType<R extends
|
|
5
|
+
type ValueofTypeSub<R extends UnknownShape> = Type<R[keyof R]['defaultValue']>;
|
|
6
|
+
type ValueOfType<R extends UnknownShape> = IsNever<keyof R> extends true ? Type<undefined> : ValueofTypeSub<R>;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=valueof.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueof.d.mts","sourceRoot":"","sources":["../../src/record/valueof.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"valueof.d.mts","sourceRoot":"","sources":["../../src/record/valueof.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,OAAO,GAAI,KAAK,CAAC,CAAC,SAAS,YAAY,EAClD,YAAY,UAAU,CAAC,CAAC,CAAC,EACzB,UAAU,OAAO,CACf,QAAQ,CAAC;IACP,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CACH,KACA,WAAW,CAAC,CAAC,CAiBf,CAAC;AAEF,KAAK,cAAc,CAAC,CAAC,SAAS,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;AAE/E,KAAK,WAAW,CAAC,CAAC,SAAS,YAAY,IACrC,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueof.mjs","sources":["../../src/record/valueof.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAKa,OAAO,GAAG,CACrB,UAAyB,EACzB,OAIC,KACiB;IAClB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;IAE7C,IAAI,GAAG,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE;;QAEtC,OAAO,KAAK,CAAC,KAAK,EAAE;YAClB,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAA,QAAA,EAAW,UAAU,CAAC,QAAQ,CAAA,CAAA,CAAG;AACjE,SAAA,CAA+C;;AAGlD,IAAA,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;;AAEzB,QAAA,OAAO,KAAK,CAAC,CAAC,CAA+C;;;AAI/D,IAAA,OAAO,aAAsC;AAC/C;
|
|
1
|
+
{"version":3,"file":"valueof.mjs","sources":["../../src/record/valueof.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;MAKa,OAAO,GAAG,CACrB,UAAyB,EACzB,OAIC,KACiB;IAClB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;IAE7C,IAAI,GAAG,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE;;QAEtC,OAAO,KAAK,CAAC,KAAK,EAAE;YAClB,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAA,QAAA,EAAW,UAAU,CAAC,QAAQ,CAAA,CAAA,CAAG;AACjE,SAAA,CAA+C;;AAGlD,IAAA,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;;AAEzB,QAAA,OAAO,KAAK,CAAC,CAAC,CAA+C;;;AAI/D,IAAA,OAAO,aAAsC;AAC/C;AAOA;;;;"}
|
package/dist/type.d.mts
CHANGED
|
@@ -27,7 +27,8 @@ export type OptionalType<A> = MergeIntersection<Type<A> & Readonly<{
|
|
|
27
27
|
}>>;
|
|
28
28
|
export type ExcessPropertyBehavior = 'allow' | 'strip' | 'error';
|
|
29
29
|
export type ExcessPropertyFillBehavior = Extract<ExcessPropertyBehavior, 'allow' | 'strip'>;
|
|
30
|
-
export type
|
|
30
|
+
export type UnknownShape = ReadonlyRecord<string, Type<unknown>>;
|
|
31
|
+
export type RecordType<R extends UnknownShape, ExcessPropertyValidation extends ExcessPropertyBehavior = 'strip'> = Type<ExcessPropertyValidation extends 'allow' ? TsFortressInternal.RecordTypeValue<R> | UnknownRecord : TsFortressInternal.RecordTypeValue<R>> & Readonly<{
|
|
31
32
|
shape: R;
|
|
32
33
|
excessPropertyValidation: ExcessPropertyValidation;
|
|
33
34
|
excessPropertyFill: ExcessPropertyFillBehavior;
|
package/dist/type.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.mts","sourceRoot":"","sources":["../src/type.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;;;;;;;GASG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,QAAQ,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,CAAC,CAAC;IAChB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC;IACxB,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC;IACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;IAEhE,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,IAAI,CAAC;CACjB,CAAC,CAAC;AAEH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC;AAEhE,kBAAkB;AAClB,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,iBAAiB,CAC7C,IAAI,CAAC,CAAC,CAAC,GACL,QAAQ,CAAC;IACP,QAAQ,EAAE,IAAI,CAAC;CAChB,CAAC,CACL,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjE,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAC9C,sBAAsB,EACtB,OAAO,GAAG,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,GAAG,CAAC,CAAC;KAAE,CAAC,CACrD,GACD,iBAAiB,CACf,QAAQ,CACN;SAAG,GAAG,IAAI,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KAAE,GAAG;SAC1C,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACxD,CACF,CACF,CAAC;IAEV,KAAK,gBAAgB,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI;SACtE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,CAAC;YAAE,QAAQ,EAAE,IAAI,CAAA;SAAE,CAAC,GAAG,CAAC,GAAG,KAAK;KACtE,CAAC,MAAM,CAAC,CAAC,CAAC;;CACZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-fortress",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@sindresorhus/is": "^7.2.0",
|
|
79
|
-
"ts-data-forge": "^6.
|
|
79
|
+
"ts-data-forge": "^6.6.0",
|
|
80
80
|
"ts-type-forge": "^2.3.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
@@ -87,20 +87,20 @@
|
|
|
87
87
|
"@semantic-release/commit-analyzer": "13.0.1",
|
|
88
88
|
"@semantic-release/exec": "7.1.0",
|
|
89
89
|
"@semantic-release/git": "10.0.1",
|
|
90
|
-
"@semantic-release/github": "12.0.
|
|
91
|
-
"@semantic-release/npm": "13.1.
|
|
90
|
+
"@semantic-release/github": "12.0.6",
|
|
91
|
+
"@semantic-release/npm": "13.1.5",
|
|
92
92
|
"@semantic-release/release-notes-generator": "14.1.0",
|
|
93
|
-
"@types/node": "25.
|
|
93
|
+
"@types/node": "25.4.0",
|
|
94
94
|
"@vitest/browser-playwright": "4.0.18",
|
|
95
95
|
"@vitest/coverage-v8": "4.0.18",
|
|
96
96
|
"@vitest/ui": "4.0.18",
|
|
97
|
-
"conventional-changelog-conventionalcommits": "9.
|
|
98
|
-
"cspell": "9.
|
|
97
|
+
"conventional-changelog-conventionalcommits": "9.3.0",
|
|
98
|
+
"cspell": "9.7.0",
|
|
99
99
|
"eslint": "9.39.3",
|
|
100
|
-
"eslint-config-typed": "4.
|
|
100
|
+
"eslint-config-typed": "4.7.4",
|
|
101
101
|
"fast-glob": "3.3.3",
|
|
102
102
|
"fp-ts": "2.16.11",
|
|
103
|
-
"github-settings-as-code": "1.
|
|
103
|
+
"github-settings-as-code": "1.2.0",
|
|
104
104
|
"io-ts": "2.2.22",
|
|
105
105
|
"jiti": "2.6.1",
|
|
106
106
|
"markdownlint": "0.40.0",
|
|
@@ -109,15 +109,15 @@
|
|
|
109
109
|
"playwright": "1.58.2",
|
|
110
110
|
"prettier": "3.8.1",
|
|
111
111
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
112
|
-
"prettier-plugin-packagejson": "3.0.
|
|
112
|
+
"prettier-plugin-packagejson": "3.0.2",
|
|
113
113
|
"rollup": "4.59.0",
|
|
114
114
|
"semantic-release": "25.0.3",
|
|
115
|
-
"ts-codemod-lib": "^2.
|
|
116
|
-
"ts-repo-utils": "
|
|
115
|
+
"ts-codemod-lib": "^2.1.1",
|
|
116
|
+
"ts-repo-utils": "9.0.0",
|
|
117
117
|
"tslib": "2.8.1",
|
|
118
118
|
"tsx": "4.21.0",
|
|
119
119
|
"typedoc": "0.28.17",
|
|
120
|
-
"typedoc-github-theme": "0.
|
|
120
|
+
"typedoc-github-theme": "0.4.0",
|
|
121
121
|
"typescript": "5.9.3",
|
|
122
122
|
"vite": "7.3.1",
|
|
123
123
|
"vitest": "4.0.18",
|
package/src/compose/index.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { expectType } from 'ts-data-forge';
|
|
2
2
|
import { array } from '../array/index.mjs';
|
|
3
3
|
import { brandedString } from '../brand/index.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { union } from '../compose/index.mjs';
|
|
5
5
|
import { boolean, nullType, number, string } from '../primitives/index.mjs';
|
|
6
6
|
import {
|
|
7
7
|
keyof,
|
|
8
8
|
keyValueRecord,
|
|
9
|
+
mergeRecords,
|
|
9
10
|
omit,
|
|
10
11
|
optional,
|
|
11
12
|
partial,
|
package/src/record/index.mts
CHANGED
package/src/record/keyof.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Arr, expectType, pipe } from 'ts-data-forge';
|
|
2
2
|
import { enumType } from '../enum/index.mjs';
|
|
3
3
|
import { undefinedType } from '../primitives/index.mjs';
|
|
4
|
-
import { type RecordType, type Type } from '../type.mjs';
|
|
4
|
+
import { type RecordType, type Type, type UnknownShape } from '../type.mjs';
|
|
5
5
|
|
|
6
|
-
export const keyof = <const R extends
|
|
6
|
+
export const keyof = <const R extends UnknownShape>(
|
|
7
7
|
recordType: RecordType<R>,
|
|
8
8
|
options?: Partial<
|
|
9
9
|
Readonly<{
|
|
@@ -20,7 +20,7 @@ export const keyof = <const R extends ReadonlyRecord<string, Type<unknown>>>(
|
|
|
20
20
|
: (undefinedType satisfies Type<undefined>),
|
|
21
21
|
).value as KeyofType<R>;
|
|
22
22
|
|
|
23
|
-
const getKeys = <const R extends
|
|
23
|
+
const getKeys = <const R extends UnknownShape>(
|
|
24
24
|
recordType: RecordType<R>,
|
|
25
25
|
): readonly ToString<keyof R>[] =>
|
|
26
26
|
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
@@ -30,11 +30,9 @@ const getKeys = <const R extends ReadonlyRecord<string, Type<unknown>>>(
|
|
|
30
30
|
keyof R
|
|
31
31
|
>[];
|
|
32
32
|
|
|
33
|
-
type KeyofTypeSub<R extends
|
|
34
|
-
ToString<keyof R>
|
|
35
|
-
>;
|
|
33
|
+
type KeyofTypeSub<R extends UnknownShape> = Type<ToString<keyof R>>;
|
|
36
34
|
|
|
37
|
-
type KeyofType<R extends
|
|
35
|
+
type KeyofType<R extends UnknownShape> =
|
|
38
36
|
IsNever<keyof R> extends true ? Type<undefined> : KeyofTypeSub<R>;
|
|
39
37
|
|
|
40
38
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|