inferred-types 0.22.0 → 0.22.5
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/dist/index.d.ts +69 -47
- package/dist/index.js +40 -16
- package/dist/index.mjs +39 -15
- package/package.json +18 -14
- package/src/Mutation/index.ts +6 -29
- package/src/index.ts +6 -29
- package/src/shared/index.ts +6 -29
- package/src/types/Keys.ts +10 -6
- package/src/types/alphabetic/CamelCase.ts +1 -1
- package/src/types/alphabetic/alpha-characters.ts +33 -9
- package/src/types/alphabetic/index.ts +6 -29
- package/src/types/dictionary/DictChangeValue.ts +26 -0
- package/src/types/dictionary/MutableProps.ts +19 -0
- package/src/types/dictionary/index.ts +7 -29
- package/src/types/dictionary/props.ts +1 -1
- package/src/types/fluent/index.ts +6 -29
- package/src/types/functions/index.ts +6 -29
- package/src/types/index.ts +6 -29
- package/src/types/kv/index.ts +6 -29
- package/src/types/lists/index.ts +6 -29
- package/src/types/string-literals/index.ts +6 -29
- package/src/types/tuples/index.ts +6 -29
- package/src/types/type-conversion/index.ts +6 -29
- package/src/utility/api/index.ts +6 -29
- package/src/utility/dictionary/defineProperties.ts +35 -0
- package/src/utility/dictionary/index.ts +7 -29
- package/src/utility/dictionary/kv/index.ts +6 -29
- package/src/utility/errors/ReadOnlyViolation.ts +3 -0
- package/src/utility/errors/index.ts +12 -0
- package/src/utility/index.ts +7 -29
- package/src/utility/lists/index.ts +6 -29
- package/src/utility/literals/index.ts +6 -29
- package/src/utility/map-reduce/index.ts +6 -29
- package/src/utility/modelling/index.ts +6 -29
- package/src/utility/runtime/conditions/index.ts +6 -30
- package/src/utility/runtime/ifTypeOf.ts +4 -3
- package/src/utility/runtime/index.ts +6 -29
- package/src/utility/state/index.ts +6 -29
- package/tests/data/index.ts +6 -29
- package/tests/dictionary/DictChangeValue.test.ts +30 -0
- package/tests/dictionary/DictReturnValues.test.ts +5 -1
- package/tests/dictionary/MutableProps.test.ts +30 -0
- package/src/utility/runtime/conditions/isLiteral.ts +0 -7
|
@@ -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
|
|
3
|
-
// index last changed at:
|
|
4
|
-
// hash-code:
|
|
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
|
-
//
|
|
18
|
-
//
|
|
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
|
|
3
|
-
// index last changed at:
|
|
4
|
-
// hash-code:
|
|
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
|
-
//
|
|
15
|
-
//
|
|
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,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
|
package/src/utility/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// #autoindex
|
|
2
2
|
|
|
3
|
-
// #region
|
|
4
|
-
// index last changed at:
|
|
5
|
-
// hash-code:
|
|
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
|
-
//
|
|
24
|
-
//
|
|
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
|
|
4
|
-
// index last changed at:
|
|
5
|
-
// hash-code:
|
|
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
|
-
//
|
|
13
|
-
//
|
|
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
|
|
3
|
-
// index last changed at:
|
|
4
|
-
// hash-code:
|
|
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
|
-
//
|
|
16
|
-
//
|
|
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
|
|
3
|
-
// index last changed at:
|
|
4
|
-
// hash-code:
|
|
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
|
-
//
|
|
12
|
-
//
|
|
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
|
|
3
|
-
// index last changed at:
|
|
4
|
-
// hash-code:
|
|
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
|
-
//
|
|
12
|
-
//
|
|
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
|
|
4
|
-
// index last changed at:
|
|
5
|
-
// hash-code:
|
|
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
|
-
//
|
|
24
|
-
//
|
|
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
|
|
3
|
-
// index last changed at:
|
|
4
|
-
// hash-code:
|
|
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
|
-
//
|
|
17
|
-
//
|
|
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
|
|
3
|
-
// index last changed at:
|
|
4
|
-
// hash-code:
|
|
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
|
-
//
|
|
13
|
-
//
|
|
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
|
package/tests/data/index.ts
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
// #autoindex
|
|
2
2
|
|
|
3
|
-
// #region
|
|
4
|
-
// index last changed at:
|
|
5
|
-
// hash-code:
|
|
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
|
-
//
|
|
12
|
-
//
|
|
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
|
+
});
|
|
@@ -25,7 +25,11 @@ describe("DictReturnValues<T, R, O>", () => {
|
|
|
25
25
|
multiply: (v1: number, v2: number) => null;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
type cases = [
|
|
28
|
+
type cases = [
|
|
29
|
+
//
|
|
30
|
+
Expect<Equal<T1, Expected1>>,
|
|
31
|
+
Expect<Equal<T2, Expected2>>
|
|
32
|
+
];
|
|
29
33
|
|
|
30
34
|
const cases: cases = [true, true];
|
|
31
35
|
});
|