@ptolemy2002/ts-utils 1.3.1 → 1.4.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.ts +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export type KeysMatching<T, V> = {
|
|
|
9
9
|
[K in keyof T]-?: T[K] extends V ? K : never;
|
|
10
10
|
}[keyof T];
|
|
11
11
|
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
12
|
+
export type AtLeastOne<T, U = {
|
|
13
|
+
[K in keyof T]: Pick<T, K>;
|
|
14
|
+
}> = Partial<T> & U[keyof U];
|
|
12
15
|
export type ValueCondition<T> = ({
|
|
13
16
|
_isCondition: true;
|
|
14
17
|
} & Partial<{
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ function valueConditionMatches(value, condition) {
|
|
|
10
10
|
if (isCallable(condition))
|
|
11
11
|
return condition(value);
|
|
12
12
|
// If the condition value here is not a condition object, it must be of type T, so we can directly compare it
|
|
13
|
-
if (
|
|
13
|
+
if (condition._isCondition !== true)
|
|
14
14
|
return Object.is(value, condition);
|
|
15
15
|
let { include = [], exclude = [], match = Object.is } = condition;
|
|
16
16
|
if (!Array.isArray(include))
|