diff --git a/CHANGELOG.md b/CHANGELOG.md index 2261e53..3419827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # deverything +## 0.37.0 + +### Minor Changes + +- map generics + ## 0.36.0 ### Minor Changes diff --git a/README.md b/README.md index 9a65ef2..f0ba16e 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ Checks are functions that throw an error, if the validation fails - ⭐ `checkEnvVars()` Make sure env vars are set per-environment -### TypeScript Helpers +### TypeScript Helpers & Generics - `Coords` - `DateLike` @@ -164,10 +164,19 @@ Checks are functions that throw an error, if the validation fails - `MaybePromiseOrValueArray<>` - `NonUndefined` - `ObjectKey<>` +- `ObjectKeys<>` - `ObjectValue<>` -- `PlainObject` +- `ObjectValues<>` +- `ObjectEntries<>` +- ⭐ `PlainObject` use this instead of `Record<,>` or `extends object`, also makes sure it's not an array - `Point` - `PrismaSelect<>` +- `HashMap<>` +- `HashMapKey` +- `NumberMap` +- `StringMap` +- `BoolMap` +- `TrueMap` ## Development diff --git a/package.json b/package.json index f459f8c..9e0330b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deverything", - "version": "0.36.0", + "version": "0.37.0", "description": "Everything you need for Dev", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/src/types/HashMap.ts b/src/types/HashMap.ts new file mode 100644 index 0000000..9e9a0dd --- /dev/null +++ b/src/types/HashMap.ts @@ -0,0 +1,7 @@ +// I don't like the Dict keyword, but it's a possibility... +export type HashMapKey = string | number | symbol; +export type HashMap = Record; +export type NumberMap = Record; +export type StringMap = Record; +export type BoolMap = Record; +export type TrueMap = Record; diff --git a/src/types/Object.ts b/src/types/Object.ts index 3da775a..5b643eb 100644 --- a/src/types/Object.ts +++ b/src/types/Object.ts @@ -1,4 +1,6 @@ -export type ObjectValue = T[keyof T]; -export type ObjectValues = ObjectValue[]; export type ObjectKey = keyof T; export type ObjectKeys = ObjectKey[]; +export type ObjectValue = T[keyof T]; +export type ObjectValues = ObjectValue[]; +// ObjectEntry needed? +export type ObjectEntries = { [K in keyof T]: [K, T[K]] }[keyof T][]; diff --git a/src/types/index.ts b/src/types/index.ts index da3a052..df783cb 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,6 +1,7 @@ export * from "./Coords"; export * from "./Date"; export * from "./Dimensions"; +export * from "./HashMap"; export * from "./Matrix"; export * from "./Maybe"; export * from "./NonUndefined";