@ptolemy2002/ts-utils 1.0.0 → 1.2.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/README.md CHANGED
@@ -27,9 +27,15 @@ This type returns a union of the type `T` and a promise that resolves to the typ
27
27
  ### TAndOthers<T, K extends keyof any = PropertyKey>
28
28
  This type returns an object with all the properties of `T` and any number of other properties under keys that fit the type `K`. The additional properties will all have the type `any` because I couldn't figure out how to make them have a type that does not include `ValueOf<T>` due to the way Typescript handles mapped object types.
29
29
 
30
+ ### KeysMatching<T, V>
31
+ This type returns a union of all the keys in `T` that have a value assignable to `V`.
32
+
30
33
  ## Peer Dependencies
31
34
  None
32
35
 
36
+ ## PartialBy<T, K extends keyof T>
37
+ This type returns a type that is the same as `T` except that the keys in `K` are optional.
38
+
33
39
  ## Commands
34
40
  The following commands exist in the project:
35
41
 
package/dist/index.d.ts CHANGED
@@ -5,3 +5,7 @@ export type MaybeTransformerRecord<T, Args extends any[] = []> = {
5
5
  };
6
6
  export type MaybePromise<T> = T | Promise<T>;
7
7
  export type TAndOthers<T, K extends keyof any = PropertyKey> = Record<K, any> & T;
8
+ export type KeysMatching<T, V> = {
9
+ [K in keyof T]-?: T[K] extends V ? K : never;
10
+ }[keyof T];
11
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/ts-utils",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,4 +27,4 @@
27
27
  "release-major": "bash ./scripts/release.sh major"
28
28
  },
29
29
  "devDependencies": {}
30
- }
30
+ }