@zayne-labs/toolkit-type-helpers 0.12.46 → 0.12.47

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.
@@ -43,6 +43,9 @@ type LiteralUnion<TUnion extends TBase, TBase = string> = TUnion | (TBase & Reco
43
43
  type Expect<TType extends true> = TType;
44
44
  type GetGenericFn<TType> = <TGenericFnParam>() => TGenericFnParam extends TType ? true : false;
45
45
  type Equal<TTypeOne, TTypeTwo> = GetGenericFn<TTypeOne> extends GetGenericFn<TTypeTwo> ? true : false;
46
+ type Satisfies<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = TActualType;
47
+ type SatisfiesStrictOnValue<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = { [Key in keyof TActualType]: Key extends keyof TExpectedTypeShape ? TActualType[Key] : never };
48
+ type SatisfiesStrictOnKey<TActualType extends TExpectedTypeShape, TExpectedTypeShape> = { [Key in keyof TActualType as Key extends keyof TExpectedTypeShape ? Key : never]: TActualType[Key] };
46
49
  //#endregion
47
50
  //#region src/type-utils/writeable.d.ts
48
51
  type ArrayOrObject = Record<number | string | symbol, unknown> | unknown[] | readonly unknown[];
@@ -85,6 +88,10 @@ type UnionDiscriminator<TArrayOfTypes extends unknown[], TErrorMessages extends
85
88
  type InferredUnionVariant = "keys" | "values";
86
89
  type ExtractUnion<TObject, TVariant extends InferredUnionVariant = "keys"> = TObject extends Array<infer TUnion> | ReadonlyArray<infer TUnion> | Set<infer TUnion> ? TUnion : TObject extends Record<infer TKeys, infer TValues> ? TVariant extends "keys" ? TKeys : Prettify<Writeable<TValues, "deep">> : never;
87
90
  type UnionToIntersection<TUnion> = (TUnion extends unknown ? (param: TUnion) => void : never) extends ((param: infer TParam) => void) ? TParam : never;
91
+ type LastOf<TValue> = UnionToIntersection<TValue extends unknown ? () => TValue : never> extends (() => infer R) ? R : never;
92
+ type Push<TArray extends unknown[], TArrayItem> = [...TArray, TArrayItem];
93
+ type UnionToTupleImpl<TUnion, TComputedLastUnion = LastOf<TUnion>, TComputedIsUnionEqualToNever = ([TUnion] extends [never] ? true : false)> = true extends TComputedIsUnionEqualToNever ? [] : Push<UnionToTupleImpl<Exclude<TUnion, TComputedLastUnion>>, TComputedLastUnion>;
94
+ type UnionToTuple<TUnion, TArray extends TUnion[] = []> = UnionToTupleImpl<TUnion>["length"] extends TArray["length"] ? [...TArray] : UnionToTuple<TUnion, [TUnion, ...TArray]>;
88
95
  //#endregion
89
96
  //#region src/guard.d.ts
90
97
  declare const isString: (value: unknown) => value is string;
@@ -168,5 +175,5 @@ declare const defineEnumDeep: <const TValue extends object, TOptions extends Def
168
175
  writeableLevel: "deep";
169
176
  })["writeableLevel"]> : never : never;
170
177
  //#endregion
171
- export { AnyAsyncFunction, AnyFunction, AnyNumber, AnyObject, AnyString, AssertionError, Awaitable, CallbackFn, DeepPrettify, DistributiveOmit, DistributivePick, EmptyObject, Equal, Expect, ExtractUnion, InferredUnionVariant, LiteralUnion, NoInferUnMasked, NonEmptyArray, NonFalsy, Prettify, PrettyOmit, PrettyPick, SelectorFn, UnionDiscriminator, UnionToIntersection, UnknownObject, UnknownObjectWithAnyKey, UnmaskType, Writeable, WriteableLevel, assert, assertDefined, assertENV, defineEnum, defineEnumDeep, hasObjectPrototype, isArray, isAsyncFunction, isBlob, isBoolean, isFile, isFormData, isFunction, isIterable, isJSONSerializable, isJsonString, isMap, isNumber, isObject, isObjectAndNotArray, isPlainObject, isPromise, isSerializableObject, isSet, isString, isSymbol, isValidJsonString };
178
+ export { AnyAsyncFunction, AnyFunction, AnyNumber, AnyObject, AnyString, AssertionError, Awaitable, CallbackFn, DeepPrettify, DistributiveOmit, DistributivePick, EmptyObject, Equal, Expect, ExtractUnion, InferredUnionVariant, LiteralUnion, NoInferUnMasked, NonEmptyArray, NonFalsy, Prettify, PrettyOmit, PrettyPick, Satisfies, SatisfiesStrictOnKey, SatisfiesStrictOnValue, SelectorFn, UnionDiscriminator, UnionToIntersection, UnionToTuple, UnknownObject, UnknownObjectWithAnyKey, UnmaskType, Writeable, WriteableLevel, assert, assertDefined, assertENV, defineEnum, defineEnumDeep, hasObjectPrototype, isArray, isAsyncFunction, isBlob, isBoolean, isFile, isFormData, isFunction, isIterable, isJSONSerializable, isJsonString, isMap, isNumber, isObject, isObjectAndNotArray, isPlainObject, isPromise, isSerializableObject, isSet, isString, isSymbol, isValidJsonString };
172
179
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zayne-labs/toolkit-type-helpers",
3
3
  "type": "module",
4
- "version": "0.12.46",
4
+ "version": "0.12.47",
5
5
  "description": "A collection of utility functions, types and composables used by my other projects. Nothing too fancy but can be useful.",
6
6
  "author": "Ryan Zayne",
7
7
  "license": "MIT",
@@ -43,9 +43,9 @@
43
43
  "cross-env": "^10.1.0",
44
44
  "publint": "^0.3.18",
45
45
  "size-limit": "^12.0.1",
46
- "tsdown": "0.21.5",
46
+ "tsdown": "0.21.7",
47
47
  "typescript": "6.0.2",
48
- "vitest": "4.1.1"
48
+ "vitest": "4.1.2"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public",
@@ -64,8 +64,8 @@
64
64
  "build:test": "concurrently --prefix-colors \"yellow.bold,#7da4f8.bold,magenta\" --names PUBLINT,TSUP 'pnpm:lint:publint' 'pnpm:build:dev'",
65
65
  "dev": "pnpm build:dev --watch",
66
66
  "lint:attw": "attw --pack . --ignore-rules=cjs-resolves-to-esm",
67
- "lint:eslint": "eslint . --max-warnings 0",
68
- "lint:eslint:interactive": "pnpx eslint-interactive@latest . --max-warnings 0 --fix",
67
+ "lint:eslint": "eslint . --max-warnings=0",
68
+ "lint:eslint:interactive": "pnpx eslint-interactive@latest . --max-warnings=0 --fix",
69
69
  "lint:format": "prettier --write .",
70
70
  "lint:publint": "publint --strict .",
71
71
  "lint:size": "size-limit",