@alessiofrittoli/type-utils 1.9.0 → 1.10.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
@@ -11,7 +11,6 @@
11
11
  [downloads-badge]: https://img.shields.io/npm/dm/%40alessiofrittoli%2Ftype-utils.svg
12
12
  [deps-badge]: https://img.shields.io/librariesio/release/npm/%40alessiofrittoli%2Ftype-utils
13
13
  [deps-url]: https://libraries.io/npm/%40alessiofrittoli%2Ftype-utils
14
-
15
14
  [sponsor-badge]: https://img.shields.io/static/v1?label=Fund%20this%20package&message=%E2%9D%A4&logo=GitHub&color=%23DB61A2
16
15
  [sponsor-url]: https://github.com/sponsors/alessiofrittoli
17
16
 
@@ -34,7 +33,7 @@
34
33
  - [Body](https://github.com/alessiofrittoli/type-utils/blob/master/docs/extenders/README.md#body)
35
34
  - [Body.json\<T\>()](https://github.com/alessiofrittoli/type-utils/blob/master/docs/extenders/README.md#bodyjsont)
36
35
  - [Development](#development)
37
- - [Install depenendencies](#install-depenendencies)
36
+ - [Install dependencies](#install-dependencies)
38
37
  - [Build the source code](#build-the-source-code)
39
38
  - [ESLint](#eslint)
40
39
  - [Contributing](#contributing)
@@ -84,7 +83,7 @@ node node_modules/@alessiofrittoli/type-utils/scripts/postinstall/index.js
84
83
 
85
84
  ### Development
86
85
 
87
- #### Install depenendencies
86
+ #### Install dependencies
88
87
 
89
88
  ```bash
90
89
  npm install
@@ -106,7 +105,7 @@ pnpm build
106
105
 
107
106
  #### [ESLint](https://www.npmjs.com/package/eslint)
108
107
 
109
- warnings / errors check.
108
+ Run warnings and errors checks.
110
109
 
111
110
  ```bash
112
111
  pnpm lint
package/dist/index.cjs ADDED
File without changes
@@ -0,0 +1,104 @@
1
+ //#region src/globals/extenders/json.d.ts
2
+ declare class Stringified<T> extends String {
3
+ private ___stringified;
4
+ }
5
+ declare global {
6
+ interface JSON {
7
+ stringify<T>(value: T, replacer?: (this: {
8
+ '': T;
9
+ } | T, key: string, value: T) => any, space?: string | number): T extends Date ? string : string & Stringified<T>;
10
+ stringify<T>(value: T, replacer?: (T extends object ? (keyof T)[] : (number | string)[]) | null, space?: string | number): T extends Date ? string : string & Stringified<T>;
11
+ parse<T, U extends keyof T = keyof T>(text: string | Stringified<T>, reviver?: (key: U, value: T[U]) => any): T;
12
+ parse(text: string, reviver?: (key: any, value: any) => any): any;
13
+ }
14
+ interface Body {
15
+ json<T = any>(): Promise<T>;
16
+ }
17
+ }
18
+ //#endregion
19
+ //#region src/globals/utils/index.d.ts
20
+ declare global {
21
+ /**
22
+ * Get the Type of the Value of a object/array property.
23
+ */
24
+ type ValueOf<T> = T[keyof T];
25
+ /**
26
+ * Get the Type of the Value of object/array specific property.
27
+ */
28
+ type ValueOfKey<T, P extends keyof T> = T[P];
29
+ /**
30
+ * Make a specific property optional.
31
+ */
32
+ type OptionalKey<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
33
+ /**
34
+ * Make read-only properties of an object recursively writeable.
35
+ */
36
+ type ReadOnly<T> = keyof T extends never ? T : { readonly [P in keyof T]: Writeable<T[P]>; };
37
+ /**
38
+ * Make read-only properties of an object recursively writeable.
39
+ */
40
+ type Writeable<T> = keyof T extends never ? T : { -readonly [P in keyof T]: Writeable<T[P]>; };
41
+ /**
42
+ * Renames a property while inheriting its type.
43
+ */
44
+ type RenameKey<T, K extends keyof T, R extends PropertyKey> = Omit<T, K> & { [P in R]: T[K]; };
45
+ /** Get the Type of a function arguments. */
46
+ type ArgumentTypes<F extends Function> = F extends ((...args: infer A) => any) ? A : never;
47
+ /**
48
+ * Makes all 1st level properties of a type required.
49
+ */
50
+ type Full<T> = { [P in keyof T]-?: T[P]; };
51
+ /**
52
+ * Recursively makes all properties of a type required at all nested levels.
53
+ */
54
+ type DeepFull<T> = { [P in keyof T]-?: DeepFull<T[P]>; };
55
+ /**
56
+ * Removes `null` and `undefined` from all properties of a type.
57
+ */
58
+ type NonNullableFields<T> = { [P in keyof T]: NonNullable<T[P]>; };
59
+ /**
60
+ * Get the type of the value of merged enums.
61
+ *
62
+ * @example
63
+ *
64
+ * ```ts
65
+ * enum Mammals {
66
+ * Humans,
67
+ * Bats,
68
+ * Dolphins
69
+ * }
70
+ *
71
+ * enum Reptiles {
72
+ * Snakes,
73
+ * Alligators,
74
+ * Lizards
75
+ * }
76
+ *
77
+ * // merged enums.
78
+ * const Animals = { Mammals, Reptiles }
79
+ * type Animals = typeof Animals
80
+ *
81
+ * type Animal = MergedEnumValueType<typeof Animals>
82
+ *
83
+ * const testAnimal: Animal = 0 as any
84
+ *
85
+ * switch ( testAnimal ) {
86
+ * case Animals.Mammals.Humans:
87
+ * case Animals.Mammals.Bats:
88
+ * case Animals.Mammals.Dolphins:
89
+ * case Animals.Reptiles.Snakes:
90
+ * case Animals.Reptiles.Alligators:
91
+ * case Animals.Reptiles.Lizards:
92
+ * break
93
+ * default: {
94
+ * const invalid = testAnimal // `testAnimal` is type of never
95
+ * }
96
+ * }
97
+ * ```
98
+ */
99
+ type MergedEnumValue<T> = { [K in keyof T]: { [K2 in keyof T[K]]: T[K][K2]; }[keyof T[K]]; }[keyof T];
100
+ }
101
+ //#endregion
102
+ //#region src/index.d.ts
103
+ export type DoNotUse = never;
104
+ //#endregion
package/dist/index.d.mts CHANGED
@@ -1,112 +1,104 @@
1
+ //#region src/globals/extenders/json.d.ts
1
2
  declare class Stringified<T> extends String {
2
- private ___stringified;
3
+ private ___stringified;
3
4
  }
4
5
  declare global {
5
- interface JSON {
6
- stringify<T>(value: T, replacer?: (this: {
7
- '': T;
8
- } | T, key: string, value: T) => any, space?: string | number): T extends Date ? string : string & Stringified<T>;
9
- stringify<T>(value: T, replacer?: (T extends object ? (keyof T)[] : (number | string)[]) | null, space?: string | number): T extends Date ? string : string & Stringified<T>;
10
- parse<T, U extends keyof T = keyof T>(text: string | Stringified<T>, reviver?: (key: U, value: T[U]) => any): T;
11
- parse(text: string, reviver?: (key: any, value: any) => any): any;
12
- }
13
- interface Body {
14
- json<T = any>(): Promise<T>;
15
- }
6
+ interface JSON {
7
+ stringify<T>(value: T, replacer?: (this: {
8
+ '': T;
9
+ } | T, key: string, value: T) => any, space?: string | number): T extends Date ? string : string & Stringified<T>;
10
+ stringify<T>(value: T, replacer?: (T extends object ? (keyof T)[] : (number | string)[]) | null, space?: string | number): T extends Date ? string : string & Stringified<T>;
11
+ parse<T, U extends keyof T = keyof T>(text: string | Stringified<T>, reviver?: (key: U, value: T[U]) => any): T;
12
+ parse(text: string, reviver?: (key: any, value: any) => any): any;
13
+ }
14
+ interface Body {
15
+ json<T = any>(): Promise<T>;
16
+ }
16
17
  }
17
-
18
+ //#endregion
19
+ //#region src/globals/utils/index.d.ts
18
20
  declare global {
19
- /**
20
- * Get the Type of the Value of a object/array property.
21
- */
22
- type ValueOf<T> = T[keyof T];
23
- /**
24
- * Get the Type of the Value of object/array specific property.
25
- */
26
- type ValueOfKey<T, P extends keyof T> = T[P];
27
- /**
28
- * Make a specific property optional.
29
- */
30
- type OptionalKey<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
31
- /**
32
- * Make read-only properties of an object recursively writeable.
33
- */
34
- type Writeable<T> = {
35
- -readonly [P in keyof T]: Writeable<T[P]>;
36
- };
37
- /**
38
- * Renames a property while inheriting its type.
39
- */
40
- type RenameKey<T, K extends keyof T, R extends PropertyKey> = Omit<T, K> & {
41
- [P in R]: T[K];
42
- };
43
- /** Get the Type of a function arguments. */
44
- type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;
45
- /**
46
- * Makes all 1st level properties of a type required.
47
- */
48
- type Full<T> = {
49
- [P in keyof T]-?: T[P];
50
- };
51
- /**
52
- * Recursively makes all properties of a type required at all nested levels.
53
- */
54
- type DeepFull<T> = {
55
- [P in keyof T]-?: DeepFull<T[P]>;
56
- };
57
- /**
58
- * Removes `null` and `undefined` from all properties of a type.
59
- */
60
- type NonNullableFields<T> = {
61
- [P in keyof T]: NonNullable<T[P]>;
62
- };
63
- /**
64
- * Get the type of the value of merged enums.
65
- *
66
- * @example
67
- *
68
- * ```ts
69
- * enum Mammals {
70
- * Humans,
71
- * Bats,
72
- * Dolphins
73
- * }
74
- *
75
- * enum Reptiles {
76
- * Snakes,
77
- * Alligators,
78
- * Lizards
79
- * }
80
- *
81
- * // merged enums.
82
- * const Animals = { Mammals, Reptiles }
83
- * type Animals = typeof Animals
84
- *
85
- * type Animal = MergedEnumValueType<typeof Animals>
86
- *
87
- * const testAnimal: Animal = 0 as any
88
- *
89
- * switch ( testAnimal ) {
90
- * case Animals.Mammals.Humans:
91
- * case Animals.Mammals.Bats:
92
- * case Animals.Mammals.Dolphins:
93
- * case Animals.Reptiles.Snakes:
94
- * case Animals.Reptiles.Alligators:
95
- * case Animals.Reptiles.Lizards:
96
- * break
97
- * default: {
98
- * const invalid = testAnimal // `testAnimal` is type of never
99
- * }
100
- * }
101
- * ```
102
- */
103
- type MergedEnumValue<T> = {
104
- [K in keyof T]: {
105
- [K2 in keyof T[K]]: T[K][K2];
106
- }[keyof T[K]];
107
- }[keyof T];
21
+ /**
22
+ * Get the Type of the Value of a object/array property.
23
+ */
24
+ type ValueOf<T> = T[keyof T];
25
+ /**
26
+ * Get the Type of the Value of object/array specific property.
27
+ */
28
+ type ValueOfKey<T, P extends keyof T> = T[P];
29
+ /**
30
+ * Make a specific property optional.
31
+ */
32
+ type OptionalKey<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
33
+ /**
34
+ * Make read-only properties of an object recursively writeable.
35
+ */
36
+ type ReadOnly<T> = keyof T extends never ? T : { readonly [P in keyof T]: Writeable<T[P]>; };
37
+ /**
38
+ * Make read-only properties of an object recursively writeable.
39
+ */
40
+ type Writeable<T> = keyof T extends never ? T : { -readonly [P in keyof T]: Writeable<T[P]>; };
41
+ /**
42
+ * Renames a property while inheriting its type.
43
+ */
44
+ type RenameKey<T, K extends keyof T, R extends PropertyKey> = Omit<T, K> & { [P in R]: T[K]; };
45
+ /** Get the Type of a function arguments. */
46
+ type ArgumentTypes<F extends Function> = F extends ((...args: infer A) => any) ? A : never;
47
+ /**
48
+ * Makes all 1st level properties of a type required.
49
+ */
50
+ type Full<T> = { [P in keyof T]-?: T[P]; };
51
+ /**
52
+ * Recursively makes all properties of a type required at all nested levels.
53
+ */
54
+ type DeepFull<T> = { [P in keyof T]-?: DeepFull<T[P]>; };
55
+ /**
56
+ * Removes `null` and `undefined` from all properties of a type.
57
+ */
58
+ type NonNullableFields<T> = { [P in keyof T]: NonNullable<T[P]>; };
59
+ /**
60
+ * Get the type of the value of merged enums.
61
+ *
62
+ * @example
63
+ *
64
+ * ```ts
65
+ * enum Mammals {
66
+ * Humans,
67
+ * Bats,
68
+ * Dolphins
69
+ * }
70
+ *
71
+ * enum Reptiles {
72
+ * Snakes,
73
+ * Alligators,
74
+ * Lizards
75
+ * }
76
+ *
77
+ * // merged enums.
78
+ * const Animals = { Mammals, Reptiles }
79
+ * type Animals = typeof Animals
80
+ *
81
+ * type Animal = MergedEnumValueType<typeof Animals>
82
+ *
83
+ * const testAnimal: Animal = 0 as any
84
+ *
85
+ * switch ( testAnimal ) {
86
+ * case Animals.Mammals.Humans:
87
+ * case Animals.Mammals.Bats:
88
+ * case Animals.Mammals.Dolphins:
89
+ * case Animals.Reptiles.Snakes:
90
+ * case Animals.Reptiles.Alligators:
91
+ * case Animals.Reptiles.Lizards:
92
+ * break
93
+ * default: {
94
+ * const invalid = testAnimal // `testAnimal` is type of never
95
+ * }
96
+ * }
97
+ * ```
98
+ */
99
+ type MergedEnumValue<T> = { [K in keyof T]: { [K2 in keyof T[K]]: T[K][K2]; }[keyof T[K]]; }[keyof T];
108
100
  }
109
-
110
- type DoNotUse = never;
111
-
112
- export type { DoNotUse };
101
+ //#endregion
102
+ //#region src/index.d.ts
103
+ export type DoNotUse = never;
104
+ //#endregion
package/dist/index.mjs CHANGED
@@ -0,0 +1 @@
1
+ export{};
package/license.md CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,65 +1,97 @@
1
1
  {
2
- "name": "@alessiofrittoli/type-utils",
3
- "version": "1.9.0",
4
- "description": "Lightweight TypeScript types utilities",
5
- "author": {
6
- "name": "Alessio Frittoli",
7
- "email": "info@alessiofrittoli.it",
8
- "url": "https://alessiofrittoli.it"
9
- },
10
- "license": "MIT",
11
- "funding": [
12
- {
13
- "type": "github",
14
- "url": "https://github.com/sponsors/alessiofrittoli"
15
- }
16
- ],
17
- "keywords": [
18
- "typescript",
19
- "type-utils"
20
- ],
21
- "homepage": "https://github.com/alessiofrittoli/type-utils#readme",
22
- "bugs": {
23
- "url": "https://github.com/alessiofrittoli/type-utils/issues",
24
- "email": "info@alessiofrittoli.it"
25
- },
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/alessiofrittoli/type-utils.git"
29
- },
30
- "main": "./dist/index.js",
31
- "module": "./dist/index.mjs",
32
- "types": "./dist/index.d.ts",
33
- "files": [
34
- "dist",
35
- "scripts/postinstall"
36
- ],
37
- "scripts": {
38
- "//1a": "*********************************************************************",
39
- "//1b": "******************** DEV - BUILD - LINT - RELEASE *******************",
40
- "//1c": "*********************************************************************",
41
- "dev": "cross-env NODE_ENV=development tsup --watch",
42
- "build:prod": "cross-env NODE_ENV=production tsup",
43
- "build": "pnpm lint && pnpm build:prod",
44
- "lint": "eslint",
45
- "release": "node scripts/release.js --verbose --npm",
46
- "//2a": "*********************************************************************",
47
- "//2b": "******************************* OTHER *******************************",
48
- "//2c": "*********************************************************************",
49
- "postinstall": "node scripts/postinstall/index.js"
50
- },
51
- "devDependencies": {
52
- "@eslint/js": "^9.39.1",
53
- "@types/node": "^24.10.1",
54
- "cross-env": "^10.1.0",
55
- "eslint": "^9.39.1",
56
- "globals": "^16.5.0",
57
- "tsup": "^8.5.1",
58
- "typescript": "^5.9.3",
59
- "typescript-eslint": "^8.48.1"
60
- },
61
- "dependencies": {
62
- "@alessiofrittoli/chain-functions": "^2.5.0",
63
- "@alessiofrittoli/node-scripts": "3.2.0"
64
- }
2
+ "name": "@alessiofrittoli/type-utils",
3
+ "version": "1.10.0",
4
+ "description": "Lightweight TypeScript types utilities",
5
+ "type": "module",
6
+ "author": {
7
+ "name": "Alessio Frittoli",
8
+ "email": "info@alessiofrittoli.it",
9
+ "url": "https://alessiofrittoli.it"
10
+ },
11
+ "license": "MIT",
12
+ "funding": [
13
+ {
14
+ "type": "github",
15
+ "url": "https://github.com/sponsors/alessiofrittoli"
16
+ }
17
+ ],
18
+ "keywords": [
19
+ "typescript",
20
+ "type-utils"
21
+ ],
22
+ "homepage": "https://github.com/alessiofrittoli/type-utils#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/alessiofrittoli/type-utils/issues",
25
+ "email": "info@alessiofrittoli.it"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/alessiofrittoli/type-utils.git"
30
+ },
31
+ "engines": {
32
+ "node": ">=24.15.0",
33
+ "pnpm": ">=11.27.1"
34
+ },
35
+ "main": "./dist/index.cjs",
36
+ "module": "./dist/index.mjs",
37
+ "types": "./dist/index.d.mts",
38
+ "files": [
39
+ "dist",
40
+ "scripts/postinstall"
41
+ ],
42
+ "exports": {
43
+ ".": {
44
+ "import": {
45
+ "types": "./dist/index.d.mts",
46
+ "default": "./dist/index.mjs"
47
+ },
48
+ "require": {
49
+ "types": "./dist/index.d.cts",
50
+ "default": "./dist/index.cjs"
51
+ }
52
+ },
53
+ "./*": {
54
+ "import": {
55
+ "types": "./dist/*/index.d.mts",
56
+ "default": "./dist/*/index.mjs"
57
+ },
58
+ "require": {
59
+ "types": "./dist/*/index.d.cts",
60
+ "default": "./dist/*/index.cjs"
61
+ }
62
+ }
63
+ },
64
+ "sideEffects": false,
65
+ "peerDependencies": {
66
+ "@alessiofrittoli/chain-functions": "^2.7.0",
67
+ "@alessiofrittoli/node-scripts": "^4.0.0-alpha.3"
68
+ },
69
+ "devDependencies": {
70
+ "@alessiofrittoli/chain-functions": "^2.7.0",
71
+ "@alessiofrittoli/node-scripts": "^4.0.0-alpha.3",
72
+ "@alessiofrittoli/package-configs": "^1.6.0",
73
+ "@types/node": "^24.19.1",
74
+ "@vitest/coverage-v8": "^5.0.3",
75
+ "concurrently": "^9.2.1",
76
+ "http-server": "^14.1.1",
77
+ "oxlint": "^1.86.0",
78
+ "prettier": "^3.9.9",
79
+ "prettier-plugin-sort-imports": "^1.8.11",
80
+ "tsdown": "^0.23.0",
81
+ "typescript": "^6.0.3",
82
+ "vite": "^8.3.2"
83
+ },
84
+ "scripts": {
85
+ "//1a": "*********************************************************************",
86
+ "//1b": "******************** DEV - BUILD - LINT - RELEASE *******************",
87
+ "//1c": "*********************************************************************",
88
+ "dev": "tsdown --watch",
89
+ "build": "pnpm lint && pnpm tsc && pnpm tsdown",
90
+ "lint": "oxlint --report-unused-disable-directives --max-warnings 0",
91
+ "release": "node scripts/release.ts --verbose --npm",
92
+ "//2a": "*********************************************************************",
93
+ "//2b": "******************************* OTHER *******************************",
94
+ "//2c": "*********************************************************************",
95
+ "postinstall": "node scripts/postinstall/index.cjs"
96
+ }
65
97
  }
@@ -0,0 +1,16 @@
1
+ const { Chain } = require('@alessiofrittoli/chain-functions')
2
+ const project = require('../../package.json')
3
+ const tsSetup = require('./ts-setup.cjs')
4
+
5
+ /** @type {import( '@alessiofrittoli/chain-functions/types' ).LastChainLink<() => void | Promise<void>>} */
6
+ const lastChainLink = () => () => {
7
+ console.log({
8
+ package: project.name,
9
+ message: `Post-Install done. Thank you for installing ${project.name}!`,
10
+ })
11
+ }
12
+
13
+ /** @type {import( '@alessiofrittoli/chain-functions/types' ).ChainFactory<() => void | Promise<void>>} */
14
+ const chain = [tsSetup, lastChainLink]
15
+
16
+ Chain.functions(chain)()
package/dist/index.d.ts DELETED
@@ -1,112 +0,0 @@
1
- declare class Stringified<T> extends String {
2
- private ___stringified;
3
- }
4
- declare global {
5
- interface JSON {
6
- stringify<T>(value: T, replacer?: (this: {
7
- '': T;
8
- } | T, key: string, value: T) => any, space?: string | number): T extends Date ? string : string & Stringified<T>;
9
- stringify<T>(value: T, replacer?: (T extends object ? (keyof T)[] : (number | string)[]) | null, space?: string | number): T extends Date ? string : string & Stringified<T>;
10
- parse<T, U extends keyof T = keyof T>(text: string | Stringified<T>, reviver?: (key: U, value: T[U]) => any): T;
11
- parse(text: string, reviver?: (key: any, value: any) => any): any;
12
- }
13
- interface Body {
14
- json<T = any>(): Promise<T>;
15
- }
16
- }
17
-
18
- declare global {
19
- /**
20
- * Get the Type of the Value of a object/array property.
21
- */
22
- type ValueOf<T> = T[keyof T];
23
- /**
24
- * Get the Type of the Value of object/array specific property.
25
- */
26
- type ValueOfKey<T, P extends keyof T> = T[P];
27
- /**
28
- * Make a specific property optional.
29
- */
30
- type OptionalKey<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
31
- /**
32
- * Make read-only properties of an object recursively writeable.
33
- */
34
- type Writeable<T> = {
35
- -readonly [P in keyof T]: Writeable<T[P]>;
36
- };
37
- /**
38
- * Renames a property while inheriting its type.
39
- */
40
- type RenameKey<T, K extends keyof T, R extends PropertyKey> = Omit<T, K> & {
41
- [P in R]: T[K];
42
- };
43
- /** Get the Type of a function arguments. */
44
- type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;
45
- /**
46
- * Makes all 1st level properties of a type required.
47
- */
48
- type Full<T> = {
49
- [P in keyof T]-?: T[P];
50
- };
51
- /**
52
- * Recursively makes all properties of a type required at all nested levels.
53
- */
54
- type DeepFull<T> = {
55
- [P in keyof T]-?: DeepFull<T[P]>;
56
- };
57
- /**
58
- * Removes `null` and `undefined` from all properties of a type.
59
- */
60
- type NonNullableFields<T> = {
61
- [P in keyof T]: NonNullable<T[P]>;
62
- };
63
- /**
64
- * Get the type of the value of merged enums.
65
- *
66
- * @example
67
- *
68
- * ```ts
69
- * enum Mammals {
70
- * Humans,
71
- * Bats,
72
- * Dolphins
73
- * }
74
- *
75
- * enum Reptiles {
76
- * Snakes,
77
- * Alligators,
78
- * Lizards
79
- * }
80
- *
81
- * // merged enums.
82
- * const Animals = { Mammals, Reptiles }
83
- * type Animals = typeof Animals
84
- *
85
- * type Animal = MergedEnumValueType<typeof Animals>
86
- *
87
- * const testAnimal: Animal = 0 as any
88
- *
89
- * switch ( testAnimal ) {
90
- * case Animals.Mammals.Humans:
91
- * case Animals.Mammals.Bats:
92
- * case Animals.Mammals.Dolphins:
93
- * case Animals.Reptiles.Snakes:
94
- * case Animals.Reptiles.Alligators:
95
- * case Animals.Reptiles.Lizards:
96
- * break
97
- * default: {
98
- * const invalid = testAnimal // `testAnimal` is type of never
99
- * }
100
- * }
101
- * ```
102
- */
103
- type MergedEnumValue<T> = {
104
- [K in keyof T]: {
105
- [K2 in keyof T[K]]: T[K][K2];
106
- }[keyof T[K]];
107
- }[keyof T];
108
- }
109
-
110
- type DoNotUse = never;
111
-
112
- export type { DoNotUse };
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var r=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var a=(o,e,l,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of x(e))!y.call(o,t)&&t!==l&&r(o,t,{get:()=>e[t],enumerable:!(p=s(e,t))||p.enumerable});return o};var b=o=>a(r({},"__esModule",{value:!0}),o);var f={};module.exports=b(f);
@@ -1,16 +0,0 @@
1
- const { Chain } = require( '@alessiofrittoli/chain-functions' )
2
- const tsSetup = require( './ts-setup.js' )
3
- const project = require( '../../package.json' )
4
-
5
- /** @type {import( '@alessiofrittoli/chain-functions/types' ).LastChainLink<() => void | Promise<void>>} */
6
- const lastChainLink = () => () => {
7
- console.log( {
8
- package: project.name,
9
- message: 'Post-Install done'
10
- } )
11
- }
12
-
13
- /** @type {import( '@alessiofrittoli/chain-functions/types' ).ChainFactory<() => void | Promise<void>>} */
14
- const chain = [ tsSetup, lastChainLink ]
15
-
16
- Chain.functions( chain )()