inferred-types 0.22.0 → 0.22.6

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.
Files changed (43) hide show
  1. package/dist/index.d.ts +88 -47
  2. package/dist/index.js +40 -16
  3. package/dist/index.mjs +39 -15
  4. package/package.json +18 -14
  5. package/src/Mutation/index.ts +6 -29
  6. package/src/index.ts +6 -29
  7. package/src/shared/index.ts +6 -29
  8. package/src/types/Keys.ts +10 -6
  9. package/src/types/alphabetic/CamelCase.ts +1 -1
  10. package/src/types/alphabetic/alpha-characters.ts +33 -9
  11. package/src/types/alphabetic/index.ts +6 -29
  12. package/src/types/dictionary/DictChangeValue.ts +26 -0
  13. package/src/types/dictionary/MutableProps.ts +19 -0
  14. package/src/types/dictionary/index.ts +8 -29
  15. package/src/types/dictionary/props.ts +1 -1
  16. package/src/types/fluent/index.ts +6 -29
  17. package/src/types/functions/index.ts +6 -29
  18. package/src/types/index.ts +6 -29
  19. package/src/types/kv/index.ts +6 -29
  20. package/src/types/lists/index.ts +6 -29
  21. package/src/types/string-literals/index.ts +6 -29
  22. package/src/types/tuples/index.ts +6 -29
  23. package/src/types/type-conversion/index.ts +6 -29
  24. package/src/utility/api/index.ts +6 -29
  25. package/src/utility/dictionary/defineProperties.ts +35 -0
  26. package/src/utility/dictionary/index.ts +7 -29
  27. package/src/utility/dictionary/kv/index.ts +6 -29
  28. package/src/utility/errors/ReadOnlyViolation.ts +3 -0
  29. package/src/utility/errors/index.ts +12 -0
  30. package/src/utility/index.ts +7 -29
  31. package/src/utility/lists/index.ts +6 -29
  32. package/src/utility/literals/index.ts +6 -29
  33. package/src/utility/map-reduce/index.ts +6 -29
  34. package/src/utility/modelling/index.ts +6 -29
  35. package/src/utility/runtime/conditions/index.ts +6 -30
  36. package/src/utility/runtime/ifTypeOf.ts +4 -3
  37. package/src/utility/runtime/index.ts +6 -29
  38. package/src/utility/state/index.ts +6 -29
  39. package/tests/data/index.ts +6 -29
  40. package/tests/dictionary/DictChangeValue.test.ts +30 -0
  41. package/tests/dictionary/DictReturnValues.test.ts +5 -1
  42. package/tests/dictionary/MutableProps.test.ts +30 -0
  43. package/src/utility/runtime/conditions/isLiteral.ts +0 -7
@@ -1,35 +1,12 @@
1
1
  // #autoindex
2
- // #region autoindexed files
3
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
4
- // hash-code: d2d3ad38
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: 57c2f8db
5
5
 
6
6
  // file exports
7
7
  export * from "./api";
8
8
 
9
- // #endregion
9
+ // #endregion auto-indexed files
10
10
 
11
- // This file was created by running: "dd autoindex"; it assumes you have
12
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
13
- //
14
- // By default it assumes that exports are named exports but this can be changed by
15
- // adding a modifier to the '// #autoindex' syntax:
16
- //
17
- // - autoindex:named same as default, exports "named symbols"
18
- // - autoindex:default assumes each file is exporting a default export and
19
- // converts the default export to the name of the file
20
- // - autoindex:offset assumes files export "named symbols" but that each
21
- // file's symbols should be offset by the file's name
22
- //
23
- // You may also exclude certain files or directories by adding it to the
24
- // autoindex command. As an example:
25
- //
26
- // - autoindex:named, exclude: foo,bar,baz
27
- //
28
- // Inversely, if you state a file to be an "orphan" then autoindex files
29
- // below this file will not reference this autoindex file:
30
- //
31
- // - autoindex:named, orphan
32
- //
33
- // All content outside the "// #region" section in this file will be
34
- // preserved in situations where you need to do something paricularly awesome.
35
- // Keep on being awesome.
11
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
12
+ // for more info
@@ -0,0 +1,35 @@
1
+ export interface DefinePropertiesApi<T extends {}> {
2
+ /**
3
+ * Makes a property on the object **readonly** on the Javascript runtime
4
+ */
5
+ ro<K extends keyof T>(
6
+ prop: K,
7
+ errorMsg?: (p: K, v: any) => string
8
+ ): Omit<T, K> & Record<K, Readonly<T[K]>>;
9
+ /**
10
+ * Makes a property on the object **read/writeable** on the Javascript runtime;
11
+ * this is the default so only use this where it is needed.
12
+ */
13
+ rw<K extends keyof T>(prop: K): Omit<T, K> & Record<K, Readonly<T[K]>>;
14
+ }
15
+
16
+ export function defineProperties<T extends {}>(obj: T) {
17
+ return {
18
+ ro(prop, errorMsg) {
19
+ Object.defineProperty(obj, prop, {
20
+ writable: false,
21
+ set(v: any) {
22
+ const message = errorMsg
23
+ ? errorMsg(prop, v)
24
+ : `The ${String(
25
+ prop
26
+ )} is readonly but an attempt was made to change it's value to "${JSON.stringify(
27
+ v
28
+ )}"!`;
29
+ throw new Error(message);
30
+ },
31
+ });
32
+ return obj;
33
+ },
34
+ } as DefinePropertiesApi<T>;
35
+ }
@@ -1,10 +1,11 @@
1
1
  // #autoindex
2
- // #region autoindexed files
3
- // index last changed at: 7th Jul, 2022, 01:47 PM ( GMT-7 )
4
- // hash-code: dd2bf50a
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: b0051c37
5
5
 
6
6
  // file exports
7
7
  export * from "./arrayToKeyLookup";
8
+ export * from "./defineProperties";
8
9
  export * from "./dictionaryTransform";
9
10
  export * from "./entries";
10
11
  export * from "./mapValues";
@@ -12,30 +13,7 @@ export * from "./strArrayToDict";
12
13
  // directory exports
13
14
  export * from "./kv/index";
14
15
 
15
- // #endregion
16
+ // #endregion auto-indexed files
16
17
 
17
- // This file was created by running: "dd autoindex"; it assumes you have
18
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
19
- //
20
- // By default it assumes that exports are named exports but this can be changed by
21
- // adding a modifier to the '// #autoindex' syntax:
22
- //
23
- // - autoindex:named same as default, exports "named symbols"
24
- // - autoindex:default assumes each file is exporting a default export and
25
- // converts the default export to the name of the file
26
- // - autoindex:offset assumes files export "named symbols" but that each
27
- // file's symbols should be offset by the file's name
28
- //
29
- // You may also exclude certain files or directories by adding it to the
30
- // autoindex command. As an example:
31
- //
32
- // - autoindex:named, exclude: foo,bar,baz
33
- //
34
- // Inversely, if you state a file to be an "orphan" then autoindex files
35
- // below this file will not reference this autoindex file:
36
- //
37
- // - autoindex:named, orphan
38
- //
39
- // All content outside the "// #region" section in this file will be
40
- // preserved in situations where you need to do something paricularly awesome.
41
- // Keep on being awesome.
18
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
19
+ // for more info
@@ -1,7 +1,7 @@
1
1
  // #autoindex
2
- // #region autoindexed files
3
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
4
- // hash-code: e1ea6f41
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: dd4e4592
5
5
 
6
6
  // file exports
7
7
  export * from "./dictToKv";
@@ -9,30 +9,7 @@ export * from "./filterDictArray";
9
9
  export * from "./kv";
10
10
  export * from "./kvToDict";
11
11
 
12
- // #endregion
12
+ // #endregion auto-indexed files
13
13
 
14
- // This file was created by running: "dd autoindex"; it assumes you have
15
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
16
- //
17
- // By default it assumes that exports are named exports but this can be changed by
18
- // adding a modifier to the '// #autoindex' syntax:
19
- //
20
- // - autoindex:named same as default, exports "named symbols"
21
- // - autoindex:default assumes each file is exporting a default export and
22
- // converts the default export to the name of the file
23
- // - autoindex:offset assumes files export "named symbols" but that each
24
- // file's symbols should be offset by the file's name
25
- //
26
- // You may also exclude certain files or directories by adding it to the
27
- // autoindex command. As an example:
28
- //
29
- // - autoindex:named, exclude: foo,bar,baz
30
- //
31
- // Inversely, if you state a file to be an "orphan" then autoindex files
32
- // below this file will not reference this autoindex file:
33
- //
34
- // - autoindex:named, orphan
35
- //
36
- // All content outside the "// #region" section in this file will be
37
- // preserved in situations where you need to do something paricularly awesome.
38
- // Keep on being awesome.
14
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
15
+ // for more info
@@ -0,0 +1,3 @@
1
+ import { createError } from "brilliant-errors";
2
+
3
+ export default createError("read-only-violation", "inferred-types")()()()();
@@ -0,0 +1,12 @@
1
+ // #autoindex
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: 30d9ddb2
5
+
6
+ // file exports
7
+ export * from "./ReadOnlyViolation";
8
+
9
+ // #endregion auto-indexed files
10
+
11
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
12
+ // for more info
@@ -1,8 +1,8 @@
1
1
  // #autoindex
2
2
 
3
- // #region autoindexed files
4
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
5
- // hash-code: 6886d37a
3
+ // #region auto-indexed files
4
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
5
+ // hash-code: 9dd9ac96
6
6
 
7
7
  // file exports
8
8
  export * from "./createFnWithProps";
@@ -11,6 +11,7 @@ export * from "./ruleset";
11
11
  // directory exports
12
12
  export * from "./api/index";
13
13
  export * from "./dictionary/index";
14
+ export * from "./errors/index";
14
15
  export * from "./lists/index";
15
16
  export * from "./literals/index";
16
17
  export * from "./map-reduce/index";
@@ -18,30 +19,7 @@ export * from "./modelling/index";
18
19
  export * from "./runtime/index";
19
20
  export * from "./state/index";
20
21
 
21
- // #endregion
22
+ // #endregion auto-indexed files
22
23
 
23
- // This file was created by running: "dd autoindex"; it assumes you have
24
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
25
- //
26
- // By default it assumes that exports are named exports but this can be changed by
27
- // adding a modifier to the '// #autoindex' syntax:
28
- //
29
- // - autoindex:named same as default, exports "named symbols"
30
- // - autoindex:default assumes each file is exporting a default export and
31
- // converts the default export to the name of the file
32
- // - autoindex:offset assumes files export "named symbols" but that each
33
- // file's symbols should be offset by the file's name
34
- //
35
- // You may also exclude certain files or directories by adding it to the
36
- // autoindex command. As an example:
37
- //
38
- // - autoindex:named, exclude: foo,bar,baz
39
- //
40
- // Inversely, if you state a file to be an "orphan" then autoindex files
41
- // below this file will not reference this autoindex file:
42
- //
43
- // - autoindex:named, orphan
44
- //
45
- // All content outside the "// #region" section in this file will be
46
- // preserved in situations where you need to do something paricularly awesome.
47
- // Keep on being awesome.
24
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
25
+ // for more info
@@ -1,36 +1,13 @@
1
1
  // #autoindex
2
2
 
3
- // #region autoindexed files
4
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
5
- // hash-code: 150c313
3
+ // #region auto-indexed files
4
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
5
+ // hash-code: bf4a6791
6
6
 
7
7
  // file exports
8
8
  export * from "./groupBy";
9
9
 
10
- // #endregion
10
+ // #endregion auto-indexed files
11
11
 
12
- // This file was created by running: "dd autoindex"; it assumes you have
13
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
14
- //
15
- // By default it assumes that exports are named exports but this can be changed by
16
- // adding a modifier to the '// #autoindex' syntax:
17
- //
18
- // - autoindex:named same as default, exports "named symbols"
19
- // - autoindex:default assumes each file is exporting a default export and
20
- // converts the default export to the name of the file
21
- // - autoindex:offset assumes files export "named symbols" but that each
22
- // file's symbols should be offset by the file's name
23
- //
24
- // You may also exclude certain files or directories by adding it to the
25
- // autoindex command. As an example:
26
- //
27
- // - autoindex:named, exclude: foo,bar,baz
28
- //
29
- // Inversely, if you state a file to be an "orphan" then autoindex files
30
- // below this file will not reference this autoindex file:
31
- //
32
- // - autoindex:named, orphan
33
- //
34
- // All content outside the "// #region" section in this file will be
35
- // preserved in situations where you need to do something paricularly awesome.
36
- // Keep on being awesome.
12
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
13
+ // for more info
@@ -1,7 +1,7 @@
1
1
  // #autoindex
2
- // #region autoindexed files
3
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
4
- // hash-code: b7a5f43
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: 7a22bbbc
5
5
 
6
6
  // file exports
7
7
  export * from "./ExplicitFunction";
@@ -10,30 +10,7 @@ export * from "./defineType";
10
10
  export * from "./identity";
11
11
  export * from "./literal";
12
12
 
13
- // #endregion
13
+ // #endregion auto-indexed files
14
14
 
15
- // This file was created by running: "dd autoindex"; it assumes you have
16
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
17
- //
18
- // By default it assumes that exports are named exports but this can be changed by
19
- // adding a modifier to the '// #autoindex' syntax:
20
- //
21
- // - autoindex:named same as default, exports "named symbols"
22
- // - autoindex:default assumes each file is exporting a default export and
23
- // converts the default export to the name of the file
24
- // - autoindex:offset assumes files export "named symbols" but that each
25
- // file's symbols should be offset by the file's name
26
- //
27
- // You may also exclude certain files or directories by adding it to the
28
- // autoindex command. As an example:
29
- //
30
- // - autoindex:named, exclude: foo,bar,baz
31
- //
32
- // Inversely, if you state a file to be an "orphan" then autoindex files
33
- // below this file will not reference this autoindex file:
34
- //
35
- // - autoindex:named, orphan
36
- //
37
- // All content outside the "// #region" section in this file will be
38
- // preserved in situations where you need to do something paricularly awesome.
39
- // Keep on being awesome.
15
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
16
+ // for more info
@@ -1,35 +1,12 @@
1
1
  // #autoindex
2
- // #region autoindexed files
3
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
4
- // hash-code: 73454cdf
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: 5ffc538b
5
5
 
6
6
  // file exports
7
7
  export * from "./filter";
8
8
 
9
- // #endregion
9
+ // #endregion auto-indexed files
10
10
 
11
- // This file was created by running: "dd autoindex"; it assumes you have
12
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
13
- //
14
- // By default it assumes that exports are named exports but this can be changed by
15
- // adding a modifier to the '// #autoindex' syntax:
16
- //
17
- // - autoindex:named same as default, exports "named symbols"
18
- // - autoindex:default assumes each file is exporting a default export and
19
- // converts the default export to the name of the file
20
- // - autoindex:offset assumes files export "named symbols" but that each
21
- // file's symbols should be offset by the file's name
22
- //
23
- // You may also exclude certain files or directories by adding it to the
24
- // autoindex command. As an example:
25
- //
26
- // - autoindex:named, exclude: foo,bar,baz
27
- //
28
- // Inversely, if you state a file to be an "orphan" then autoindex files
29
- // below this file will not reference this autoindex file:
30
- //
31
- // - autoindex:named, orphan
32
- //
33
- // All content outside the "// #region" section in this file will be
34
- // preserved in situations where you need to do something paricularly awesome.
35
- // Keep on being awesome.
11
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
12
+ // for more info
@@ -1,35 +1,12 @@
1
1
  // #autoindex, exclude: IoModel
2
- // #region autoindexed files
3
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
4
- // hash-code: 34d6be17
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: db68628c
5
5
 
6
6
  // file exports
7
7
  export * from "./Model";
8
8
 
9
- // #endregion
9
+ // #endregion auto-indexed files
10
10
 
11
- // This file was created by running: "dd autoindex"; it assumes you have
12
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
13
- //
14
- // By default it assumes that exports are named exports but this can be changed by
15
- // adding a modifier to the '// #autoindex' syntax:
16
- //
17
- // - autoindex:named same as default, exports "named symbols"
18
- // - autoindex:default assumes each file is exporting a default export and
19
- // converts the default export to the name of the file
20
- // - autoindex:offset assumes files export "named symbols" but that each
21
- // file's symbols should be offset by the file's name
22
- //
23
- // You may also exclude certain files or directories by adding it to the
24
- // autoindex command. As an example:
25
- //
26
- // - autoindex:named, exclude: foo,bar,baz
27
- //
28
- // Inversely, if you state a file to be an "orphan" then autoindex files
29
- // below this file will not reference this autoindex file:
30
- //
31
- // - autoindex:named, orphan
32
- //
33
- // All content outside the "// #region" section in this file will be
34
- // preserved in situations where you need to do something paricularly awesome.
35
- // Keep on being awesome.
11
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
12
+ // for more info
@@ -1,15 +1,14 @@
1
1
  // #autoindex
2
2
 
3
- // #region autoindexed files
4
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
5
- // hash-code: a3788912
3
+ // #region auto-indexed files
4
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
5
+ // hash-code: 4324574d
6
6
 
7
7
  // file exports
8
8
  export * from "./isArray";
9
9
  export * from "./isBoolean";
10
10
  export * from "./isFalse";
11
11
  export * from "./isFunction";
12
- export * from "./isLiteral";
13
12
  export * from "./isNull";
14
13
  export * from "./isNumber";
15
14
  export * from "./isObject";
@@ -18,30 +17,7 @@ export * from "./isSymbol";
18
17
  export * from "./isTrue";
19
18
  export * from "./isUndefined";
20
19
 
21
- // #endregion
20
+ // #endregion auto-indexed files
22
21
 
23
- // This file was created by running: "dd autoindex"; it assumes you have
24
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
25
- //
26
- // By default it assumes that exports are named exports but this can be changed by
27
- // adding a modifier to the '// #autoindex' syntax:
28
- //
29
- // - autoindex:named same as default, exports "named symbols"
30
- // - autoindex:default assumes each file is exporting a default export and
31
- // converts the default export to the name of the file
32
- // - autoindex:offset assumes files export "named symbols" but that each
33
- // file's symbols should be offset by the file's name
34
- //
35
- // You may also exclude certain files or directories by adding it to the
36
- // autoindex command. As an example:
37
- //
38
- // - autoindex:named, exclude: foo,bar,baz
39
- //
40
- // Inversely, if you state a file to be an "orphan" then autoindex files
41
- // below this file will not reference this autoindex file:
42
- //
43
- // - autoindex:named, orphan
44
- //
45
- // All content outside the "// #region" section in this file will be
46
- // preserved in situations where you need to do something paricularly awesome.
47
- // Keep on being awesome.
22
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
23
+ // for more info
@@ -29,10 +29,11 @@ function runtimeExtendsCheck<TValue extends any, TBase extends any>(
29
29
  case "object":
30
30
  if (val === null && base === null) {
31
31
  return true as TValue extends TBase ? true : false;
32
+ } else {
33
+ return keys(base as object).every((i) =>
34
+ runtimeExtendsCheck((val as TValue)[i], base[i], narrow)
35
+ ) as TValue extends TBase ? true : false;
32
36
  }
33
- return keys(base as object).every((i) =>
34
- runtimeExtendsCheck(val[i], base[i], narrow)
35
- ) as TValue extends TBase ? true : false;
36
37
  }
37
38
  }
38
39
 
@@ -1,7 +1,7 @@
1
1
  // #autoindex
2
- // #region autoindexed files
3
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
4
- // hash-code: 91796b6
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: 687852c8
5
5
 
6
6
  // file exports
7
7
  export * from "./condition";
@@ -11,30 +11,7 @@ export * from "./withValue";
11
11
  // directory exports
12
12
  export * from "./conditions/index";
13
13
 
14
- // #endregion
14
+ // #endregion auto-indexed files
15
15
 
16
- // This file was created by running: "dd autoindex"; it assumes you have
17
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
18
- //
19
- // By default it assumes that exports are named exports but this can be changed by
20
- // adding a modifier to the '// #autoindex' syntax:
21
- //
22
- // - autoindex:named same as default, exports "named symbols"
23
- // - autoindex:default assumes each file is exporting a default export and
24
- // converts the default export to the name of the file
25
- // - autoindex:offset assumes files export "named symbols" but that each
26
- // file's symbols should be offset by the file's name
27
- //
28
- // You may also exclude certain files or directories by adding it to the
29
- // autoindex command. As an example:
30
- //
31
- // - autoindex:named, exclude: foo,bar,baz
32
- //
33
- // Inversely, if you state a file to be an "orphan" then autoindex files
34
- // below this file will not reference this autoindex file:
35
- //
36
- // - autoindex:named, orphan
37
- //
38
- // All content outside the "// #region" section in this file will be
39
- // preserved in situations where you need to do something paricularly awesome.
40
- // Keep on being awesome.
16
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
17
+ // for more info
@@ -1,36 +1,13 @@
1
1
  // #autoindex
2
- // #region autoindexed files
3
- // index last changed at: 7th Jul, 2022, 01:15 PM ( GMT-7 )
4
- // hash-code: 14769606
2
+ // #region auto-indexed files
3
+ // index last changed at: 8th Aug, 2022, 09:51 AM ( GMT-7 )
4
+ // hash-code: 397c607b
5
5
 
6
6
  // file exports
7
7
  export * from "./Configurator";
8
8
  export * from "./FluentConfigurator";
9
9
 
10
- // #endregion
10
+ // #endregion auto-indexed files
11
11
 
12
- // This file was created by running: "dd autoindex"; it assumes you have
13
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
14
- //
15
- // By default it assumes that exports are named exports but this can be changed by
16
- // adding a modifier to the '// #autoindex' syntax:
17
- //
18
- // - autoindex:named same as default, exports "named symbols"
19
- // - autoindex:default assumes each file is exporting a default export and
20
- // converts the default export to the name of the file
21
- // - autoindex:offset assumes files export "named symbols" but that each
22
- // file's symbols should be offset by the file's name
23
- //
24
- // You may also exclude certain files or directories by adding it to the
25
- // autoindex command. As an example:
26
- //
27
- // - autoindex:named, exclude: foo,bar,baz
28
- //
29
- // Inversely, if you state a file to be an "orphan" then autoindex files
30
- // below this file will not reference this autoindex file:
31
- //
32
- // - autoindex:named, orphan
33
- //
34
- // All content outside the "// #region" section in this file will be
35
- // preserved in situations where you need to do something paricularly awesome.
36
- // Keep on being awesome.
12
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
13
+ // for more info
@@ -1,35 +1,12 @@
1
1
  // #autoindex
2
2
 
3
- // #region autoindexed files
4
- // index last changed at: 1st Jan, 2022, 03:27 PM ( GMT-8 )
5
- // hash-code: da242834
3
+ // #region auto-indexed files
4
+ // index last changed at: 8th Aug, 2022, 06:09 PM ( GMT-7 )
5
+ // hash-code: 683d9860
6
6
 
7
7
 
8
8
 
9
- // #endregion
9
+ // #endregion auto-indexed files
10
10
 
11
- // This file was created by running: "dd autoindex"; it assumes you have
12
- // the 'do-devops' pkg (that's "dd" on npm) installed as a dev dep.
13
- //
14
- // By default it assumes that exports are named exports but this can be changed by
15
- // adding a modifier to the '// #autoindex' syntax:
16
- //
17
- // - autoindex:named same as default, exports "named symbols"
18
- // - autoindex:default assumes each file is exporting a default export and
19
- // converts the default export to the name of the file
20
- // - autoindex:offset assumes files export "named symbols" but that each
21
- // file's symbols should be offset by the file's name
22
- //
23
- // You may also exclude certain files or directories by adding it to the
24
- // autoindex command. As an example:
25
- //
26
- // - autoindex:named, exclude: foo,bar,baz
27
- //
28
- // Inversely, if you state a file to be an "orphan" then autoindex files
29
- // below this file will not reference this autoindex file:
30
- //
31
- // - autoindex:named, orphan
32
- //
33
- // All content outside the "// #region" section in this file will be
34
- // preserved in situations where you need to do something paricularly awesome.
35
- // Keep on being awesome.
11
+ // see https://github.com/inocan-group/do-devops/docs/autoindex.md
12
+ // for more info
@@ -0,0 +1,30 @@
1
+ import { describe, it } from "vitest";
2
+ import type { Expect, Equal } from "@type-challenges/utils";
3
+ import { DictChangeValue } from "../../src/types/dictionary/DictChangeValue";
4
+ import { SimplifyObject } from "../../src/types/SimplifyObject";
5
+
6
+ const test_obj = {
7
+ foo: "hello world",
8
+ bar: 42,
9
+ baz: () => "that's all folks",
10
+ } as const;
11
+ type TestObj = typeof test_obj;
12
+
13
+ describe("DictChangeValue", () => {
14
+ it("convert all KVs to a single value type", () => {
15
+ type T = DictChangeValue<TestObj, number>;
16
+
17
+ type cases = [Expect<Equal<T, { foo: number; bar: number; baz: number }>>];
18
+ const cases: cases = [true];
19
+ });
20
+
21
+ it("convert functions values to boolean", () => {
22
+ type F = DictChangeValue<TestObj, boolean, Function>;
23
+ type S = DictChangeValue<TestObj, string, string>;
24
+ type N = DictChangeValue<TestObj, number, number>;
25
+ type T = SimplifyObject<F & S & N>;
26
+
27
+ type cases = [Expect<Equal<T, { foo: string; bar: number; baz: boolean }>>];
28
+ const cases: cases = [true];
29
+ });
30
+ });