complete-common 2.28.0 → 2.29.0
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.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/types/Expect.d.cts +6 -0
- package/dist/types/Expect.d.mts +6 -0
- package/dist/types/Expect.d.ts +6 -0
- package/dist/types/Expect.d.ts.map +1 -0
- package/dist/types/KeysMatch.d.cts +25 -0
- package/dist/types/KeysMatch.d.mts +25 -0
- package/dist/types/KeysMatch.d.ts +25 -0
- package/dist/types/KeysMatch.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/types/Expect.ts +5 -0
- package/src/types/KeysMatch.ts +28 -0
package/dist/index.d.cts
CHANGED
|
@@ -17,8 +17,10 @@ export type * from "./interfaces/SemanticVersion.js";
|
|
|
17
17
|
export type * from "./types/AddSubtract.js";
|
|
18
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
19
19
|
export type * from "./types/ERange.js";
|
|
20
|
+
export type * from "./types/Expect.js";
|
|
20
21
|
export type * from "./types/Immutable.js";
|
|
21
22
|
export type * from "./types/IRange.js";
|
|
23
|
+
export type * from "./types/KeysMatch.js";
|
|
22
24
|
export type * from "./types/NaturalNumbersLessThan.js";
|
|
23
25
|
export type * from "./types/NaturalNumbersLessThanOrEqualTo.js";
|
|
24
26
|
export type * from "./types/ObjectValues.js";
|
package/dist/index.d.mts
CHANGED
|
@@ -17,8 +17,10 @@ export type * from "./interfaces/SemanticVersion.js";
|
|
|
17
17
|
export type * from "./types/AddSubtract.js";
|
|
18
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
19
19
|
export type * from "./types/ERange.js";
|
|
20
|
+
export type * from "./types/Expect.js";
|
|
20
21
|
export type * from "./types/Immutable.js";
|
|
21
22
|
export type * from "./types/IRange.js";
|
|
23
|
+
export type * from "./types/KeysMatch.js";
|
|
22
24
|
export type * from "./types/NaturalNumbersLessThan.js";
|
|
23
25
|
export type * from "./types/NaturalNumbersLessThanOrEqualTo.js";
|
|
24
26
|
export type * from "./types/ObjectValues.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -17,8 +17,10 @@ export type * from "./interfaces/SemanticVersion.js";
|
|
|
17
17
|
export type * from "./types/AddSubtract.js";
|
|
18
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
19
19
|
export type * from "./types/ERange.js";
|
|
20
|
+
export type * from "./types/Expect.js";
|
|
20
21
|
export type * from "./types/Immutable.js";
|
|
21
22
|
export type * from "./types/IRange.js";
|
|
23
|
+
export type * from "./types/KeysMatch.js";
|
|
22
24
|
export type * from "./types/NaturalNumbersLessThan.js";
|
|
23
25
|
export type * from "./types/NaturalNumbersLessThanOrEqualTo.js";
|
|
24
26
|
export type * from "./types/ObjectValues.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,mBAAmB,iCAAiC,CAAC;AACrD,mBAAmB,wBAAwB,CAAC;AAC5C,mBAAmB,yCAAyC,CAAC;AAC7D,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,sBAAsB,CA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AC/C,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Expect.d.ts","sourceRoot":"","sources":["../../src/types/Expect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to ensure that an array of keys matches an interface.
|
|
3
|
+
*
|
|
4
|
+
* For example:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* interface Foo {
|
|
8
|
+
* arg1: string;
|
|
9
|
+
* arg2: string;
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* const FOO_KEYS = ["arg1", "arg2"] as const;
|
|
13
|
+
* type _ = Expect<KeysMatch<Foo, typeof FOO_KEYS>>;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export type KeysMatch<T, Keys extends readonly PropertyKey[]> = [
|
|
17
|
+
keyof T
|
|
18
|
+
] extends [Keys[number]] ? [Keys[number]] extends [keyof T] ? true : {
|
|
19
|
+
error: "Extra keys not in interface";
|
|
20
|
+
extra: Exclude<Keys[number], keyof T>;
|
|
21
|
+
} : {
|
|
22
|
+
error: "Missing keys from interface";
|
|
23
|
+
missing: Exclude<keyof T, Keys[number]>;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=KeysMatch.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to ensure that an array of keys matches an interface.
|
|
3
|
+
*
|
|
4
|
+
* For example:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* interface Foo {
|
|
8
|
+
* arg1: string;
|
|
9
|
+
* arg2: string;
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* const FOO_KEYS = ["arg1", "arg2"] as const;
|
|
13
|
+
* type _ = Expect<KeysMatch<Foo, typeof FOO_KEYS>>;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export type KeysMatch<T, Keys extends readonly PropertyKey[]> = [
|
|
17
|
+
keyof T
|
|
18
|
+
] extends [Keys[number]] ? [Keys[number]] extends [keyof T] ? true : {
|
|
19
|
+
error: "Extra keys not in interface";
|
|
20
|
+
extra: Exclude<Keys[number], keyof T>;
|
|
21
|
+
} : {
|
|
22
|
+
error: "Missing keys from interface";
|
|
23
|
+
missing: Exclude<keyof T, Keys[number]>;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=KeysMatch.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to ensure that an array of keys matches an interface.
|
|
3
|
+
*
|
|
4
|
+
* For example:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* interface Foo {
|
|
8
|
+
* arg1: string;
|
|
9
|
+
* arg2: string;
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* const FOO_KEYS = ["arg1", "arg2"] as const;
|
|
13
|
+
* type _ = Expect<KeysMatch<Foo, typeof FOO_KEYS>>;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export type KeysMatch<T, Keys extends readonly PropertyKey[]> = [
|
|
17
|
+
keyof T
|
|
18
|
+
] extends [Keys[number]] ? [Keys[number]] extends [keyof T] ? true : {
|
|
19
|
+
error: "Extra keys not in interface";
|
|
20
|
+
extra: Exclude<Keys[number], keyof T>;
|
|
21
|
+
} : {
|
|
22
|
+
error: "Missing keys from interface";
|
|
23
|
+
missing: Exclude<keyof T, Keys[number]>;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=KeysMatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeysMatch.d.ts","sourceRoot":"","sources":["../../src/types/KeysMatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,SAAS,SAAS,WAAW,EAAE,IAAI;IAC9D,MAAM,CAAC;CACR,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GACpB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAC9B,IAAI,GACJ;IACE,KAAK,EAAE,6BAA6B,CAAC;IACrC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CACvC,GACH;IACE,KAAK,EAAE,6BAA6B,CAAC;IACrC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;CACzC,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -17,8 +17,10 @@ export type * from "./interfaces/SemanticVersion.js";
|
|
|
17
17
|
export type * from "./types/AddSubtract.js";
|
|
18
18
|
export type * from "./types/CompositionTypeSatisfiesEnum.js";
|
|
19
19
|
export type * from "./types/ERange.js";
|
|
20
|
+
export type * from "./types/Expect.js";
|
|
20
21
|
export type * from "./types/Immutable.js";
|
|
21
22
|
export type * from "./types/IRange.js";
|
|
23
|
+
export type * from "./types/KeysMatch.js";
|
|
22
24
|
export type * from "./types/NaturalNumbersLessThan.js";
|
|
23
25
|
export type * from "./types/NaturalNumbersLessThanOrEqualTo.js";
|
|
24
26
|
export type * from "./types/ObjectValues.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper type to ensure that an array of keys matches an interface.
|
|
3
|
+
*
|
|
4
|
+
* For example:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* interface Foo {
|
|
8
|
+
* arg1: string;
|
|
9
|
+
* arg2: string;
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* const FOO_KEYS = ["arg1", "arg2"] as const;
|
|
13
|
+
* type _ = Expect<KeysMatch<Foo, typeof FOO_KEYS>>;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export type KeysMatch<T, Keys extends readonly PropertyKey[]> = [
|
|
17
|
+
keyof T,
|
|
18
|
+
] extends [Keys[number]]
|
|
19
|
+
? [Keys[number]] extends [keyof T]
|
|
20
|
+
? true
|
|
21
|
+
: {
|
|
22
|
+
error: "Extra keys not in interface";
|
|
23
|
+
extra: Exclude<Keys[number], keyof T>;
|
|
24
|
+
}
|
|
25
|
+
: {
|
|
26
|
+
error: "Missing keys from interface";
|
|
27
|
+
missing: Exclude<keyof T, Keys[number]>;
|
|
28
|
+
};
|