@ptolemy2002/ts-utils 2.0.1 → 2.1.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
@@ -33,6 +33,10 @@ This type returns a union of all the keys in `T` that have a value assignable to
33
33
  ### PartialBy<T, K extends keyof T>
34
34
  This type returns a type that is the same as `T` except that the keys in `K` are optional.
35
35
 
36
+ ### Rename<T, K extends keyof T, N extends string>
37
+ This type returns a type that is the same as `T` except that the key `K` is renamed to `N`.
38
+
39
+
36
40
  ### ValueCondition<T>
37
41
  This type allows the user to specify a condition for matching a subset of type `T`. It can be one of the following:
38
42
  - A value of type `T`
package/dist/index.d.ts CHANGED
@@ -38,3 +38,6 @@ export declare class AdvancedCondition<T> {
38
38
  export type ValueCondition<T> = AdvancedCondition<T> | T | ((v: T) => boolean) | (ValueCondition<T> | false)[];
39
39
  export type OptionalValueCondition<T> = ValueCondition<T> | null;
40
40
  export declare function valueConditionMatches<T>(value: T, condition: OptionalValueCondition<T>): boolean;
41
+ export type Rename<T, K extends keyof T, N extends string> = Pick<T, Exclude<keyof T, K>> & {
42
+ [P in N]: T[K];
43
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/ts-utils",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",