@avstantso/ts 1.1.0 → 1.2.1

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 (56) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/_global/_register.d.ts +80 -0
  3. package/dist/_global/array/_register.d.ts +28 -0
  4. package/dist/_global/array/arr-n.d.ts +21 -0
  5. package/dist/_global/array/create.d.ts +59 -0
  6. package/dist/_global/array/derivative.d.ts +197 -0
  7. package/dist/_global/array/find.d.ts +89 -0
  8. package/dist/_global/array/index.d.ts +8 -0
  9. package/dist/_global/array/low-level.d.ts +84 -0
  10. package/dist/_global/array/map-key-value.d.ts +121 -0
  11. package/dist/_global/array/min-max-sort.d.ts +244 -0
  12. package/dist/_global/ascii.d.ts +76 -0
  13. package/dist/_global/boolean.d.ts +74 -0
  14. package/dist/_global/comparisons.d.ts +85 -0
  15. package/dist/_global/func.d.ts +17 -0
  16. package/dist/_global/index.d.ts +14 -0
  17. package/dist/_global/literal.d.ts +180 -0
  18. package/dist/_global/numeric/domain/describes.d.ts +62 -0
  19. package/dist/_global/numeric/domain/generated.d.ts +11240 -0
  20. package/dist/_global/numeric/domain/inc-dec.d.ts +52 -0
  21. package/dist/_global/numeric/domain/independent.d.ts +203 -0
  22. package/dist/_global/numeric/domain/index.d.ts +4 -0
  23. package/dist/_global/numeric/inc-dec.d.ts +50 -0
  24. package/dist/_global/numeric/index.d.ts +3 -0
  25. package/dist/_global/numeric/math.d.ts +257 -0
  26. package/dist/_global/resolve.d.ts +45 -0
  27. package/dist/_global/string.d.ts +306 -0
  28. package/dist/_global/structure/_register.d.ts +93 -0
  29. package/dist/_global/structure/index.d.ts +2 -0
  30. package/dist/_global/structure/structure.d.ts +289 -0
  31. package/dist/_global/type/_register.d.ts +64 -0
  32. package/dist/_global/type/def.d.ts +47 -0
  33. package/dist/_global/type/index.d.ts +7 -0
  34. package/dist/_global/type/key-arr-def.d.ts +14 -0
  35. package/dist/_global/type/key-def.d.ts +76 -0
  36. package/dist/_global/type/key-literal-default-arr.d.ts +45 -0
  37. package/dist/_global/type/not.d.ts +44 -0
  38. package/dist/_global/type/union.d.ts +33 -0
  39. package/dist/_global/union.d.ts +79 -0
  40. package/dist/_global/utility/alt.d.ts +58 -0
  41. package/dist/_global/utility/flat.d.ts +60 -0
  42. package/dist/_global/utility/if-def.d.ts +22 -0
  43. package/dist/_global/utility/index.d.ts +9 -0
  44. package/dist/_global/utility/merge.d.ts +29 -0
  45. package/dist/_global/utility/opaque.d.ts +17 -0
  46. package/dist/_global/utility/options.d.ts +34 -0
  47. package/dist/_global/utility/override.d.ts +100 -0
  48. package/dist/_global/utility/replace-key.d.ts +33 -0
  49. package/dist/_global/utility/required-optional.d.ts +24 -0
  50. package/dist/_std-ext/index.d.ts +1 -0
  51. package/dist/_std-ext/object.d.ts +23 -0
  52. package/dist/export.d.ts +2 -0
  53. package/dist/index.d.ts +4 -0
  54. package/dist/index.js +480 -0
  55. package/dist/index.js.map +1 -0
  56. package/package.json +3 -3
@@ -0,0 +1,79 @@
1
+ declare namespace AVStantso.TS {
2
+ namespace Union {
3
+ /**
4
+ * @summary Convert a union to an intersection: `X | Y | Z` ==> `X & Y & Z`
5
+ * @template U Union type
6
+ */
7
+ export type ToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
8
+ /**
9
+ * Convert a union to an overloaded function `X | Y` ==> `((x: X)=>void) & ((y:Y)=>void)`
10
+ */
11
+ type UnionToOvlds<U> = ToIntersection<U extends any ? (f: U) => void : never>;
12
+ /**
13
+ * @summary Takes last from union: `X | Y | Z` ==> `Z`\
14
+ * _⚠ May take not last_
15
+ * @template U Union type
16
+ * @example
17
+ * type n = CheckType<Pop<never>, never>;
18
+ * type u = CheckType<Pop<undefined>, undefined>;
19
+ *
20
+ * type r1 = CheckType<Pop<string>, string>;
21
+ * type r2 = CheckType<Pop<number>, number>;
22
+ * type r3 = CheckType<Pop<1 | 2 | 3>, 3>;
23
+ * type r4 = CheckType<Pop<'A' | 'B' | 'C'>, 'C'>;
24
+ */
25
+ export type Pop<U> = UnionToOvlds<U> extends ((a: infer A) => void) ? A : never;
26
+ type _ToTuple<U, R extends ArrR = [], L = Pop<U>> = [
27
+ U
28
+ ] extends [never] ? R : _ToTuple<Exclude<U, L>, [L, ...R]>;
29
+ /**
30
+ * @summary Convert union to tuple: `X | Y | Z` ==> `[X, Y, Z]`\
31
+ * _⚠ Order of items not warrant_
32
+ * @template U Union type
33
+ * @example
34
+ * type n = CheckType<ToTuple<never>, []>;
35
+ * type u = CheckType<ToTuple<undefined>, [undefined]>;
36
+ *
37
+ * type r1 = CheckType<ToTuple<string>, [string]>;
38
+ * type r2 = CheckType<TS.Array.Sort<ToTuple<1 | 2 | 3>>, [1, 2, 3]>;
39
+ *
40
+ * type n100 = Array.Numbers<100>;
41
+ * type k100 = n100[number];
42
+ * type t100 = ToTuple<k100>;
43
+ *
44
+ * interface Person {
45
+ * firstName: string;
46
+ * lastName: string;
47
+ * dob: Date;
48
+ * hasCats: false;
49
+ * }
50
+ * type Test = CheckType<
51
+ * ToTuple<keyof Person>,
52
+ * ['firstName', 'lastName', 'dob', 'hasCats']
53
+ * >;
54
+ */
55
+ export type ToTuple<U> = _ToTuple<U>;
56
+ export {};
57
+ }
58
+ /**
59
+ * @summaru Test type is union
60
+ * @template T Tested type
61
+ * @template IfTrue Result, if `Condition` is `true`
62
+ * @template IfFalse Result, if `Condition` is NOT `true`
63
+ * @returns `IfFalse` or `IfTrue` param
64
+ * @example
65
+ * type MyUnion = 'a' | 'b' | 'c';
66
+ * type NotAUnion = string;
67
+ * type AnotherUnion = number | boolean;
68
+ *
69
+ * type n = CheckType<IsUnion<never>, false>;
70
+ * type u = CheckType<IsUnion<undefined>, false>;
71
+ *
72
+ * type CheckMyUnion = CheckType<IsUnion<MyUnion>, true>;
73
+ * type CheckNotAUnion = CheckType<IsUnion<NotAUnion>, false>;
74
+ * type CheckAnotherUnion = CheckType<IsUnion<AnotherUnion>, true>;
75
+ * type CheckSingleLiteral = CheckType<IsUnion<'hello'>, false>;
76
+ * type CheckNever = CheckType<IsUnion<never>, false>;
77
+ */
78
+ type IsUnion<T, IfTrue = true, IfFalse = false> = [T] extends [Union.ToIntersection<T>] ? IfFalse : IfTrue;
79
+ }
@@ -0,0 +1,58 @@
1
+ declare namespace AVStantso.TS {
2
+ type _AltItem<T extends readonly object[], C extends object, R extends object = {}> = T extends readonly [infer F extends object, ...infer Rest extends object[]] ? _AltItem<Rest, C, R & (F extends C ? {
3
+ [K in keyof F]: F[K];
4
+ } : {
5
+ [K in keyof F]?: never;
6
+ })> : {
7
+ [K in keyof R]: R[K];
8
+ };
9
+ type _Alt<T extends readonly object[], O extends readonly object[] = T, R extends object = never> = O extends readonly [infer F extends object, ...infer Rest extends object[]] ? _Alt<T, Rest, R | _AltItem<T, F>> : R;
10
+ /**
11
+ * @summary Create object with [`Alt`]ernative fields, but not everybody fields simultaneously
12
+ * @template T If `object` — each field will be alternative, if `array` each array item will be alternative
13
+ * @return Object with alternatives
14
+ * @example
15
+ * type n = CheckType<Alt<never>, never>;
16
+ * type u = CheckType<Alt<undefined>, undefined>;
17
+ *
18
+ * type o = { a: number; b: string; c: { x: bigint } };
19
+ * type alt_o = CheckType<
20
+ * Alt<o>,
21
+ * {
22
+ * a: number;
23
+ * b?: never;
24
+ * c?: never;
25
+ * } | {
26
+ * a?: never;
27
+ * b: string;
28
+ * c?: never;
29
+ * } | {
30
+ * a?: never;
31
+ * b?: never;
32
+ * c: {
33
+ * x: bigint;
34
+ * };
35
+ * }
36
+ * >;
37
+ *
38
+ * type a = [{ a: number; b: string }, { c: { x: bigint }, d: unknown }];
39
+ * type alt_a = CheckType<
40
+ * Alt<a>,
41
+ * {
42
+ * a: number;
43
+ * b: string;
44
+ * c?: never;
45
+ * d?: never;
46
+ * } | {
47
+ * a?: never;
48
+ * b?: never;
49
+ * c: {
50
+ * x: bigint;
51
+ * };
52
+ * d: unknown;
53
+ * }
54
+ * >;
55
+ */
56
+ export type Alt<T extends object | readonly object[]> = T extends undefined ? undefined : T extends readonly object[] ? _Alt<T> : _Alt<Structure.Split<T>>;
57
+ export {};
58
+ }
@@ -0,0 +1,60 @@
1
+ declare namespace AVStantso.TS {
2
+ type _Flat<Depth extends number, P, S, D = {
3
+ [K in keyof S as keyof S[K]]: S[K];
4
+ }, C = P & {
5
+ [K in keyof D]: D[K][Extract<K, keyof D[K]>];
6
+ } & {
7
+ [K in keyof S as S[K] extends Func ? K : never]: S[K] extends Func<infer R, infer P> ? (...params: P) => R : unknown;
8
+ }, R = Flat<C, Decrement<Depth>>> = {
9
+ [K in keyof R]: R[K];
10
+ };
11
+ /**
12
+ * @summary Flatting object structure to `Depth`
13
+ * @template T Type for flatting
14
+ * @template Depth Depth of flatting. If `0`, flatting hasn't effect
15
+ * @return If `T` is object structure — flatted structure of `T`, else unchanged `T`
16
+ * @example
17
+ * type n = CheckType<Flat<never>, never>;
18
+ * type u = CheckType<Flat<undefined>, undefined>;
19
+ *
20
+ * type t = {
21
+ * v: () => Buffer,
22
+ * w: (() => string) & { n: string },
23
+ * x: { a: string; b: number };
24
+ * y: { c: { d: boolean } };
25
+ * z: bigint
26
+ * };
27
+ * type f0_0 = CheckType<Flat<t, 0>, t>;
28
+ * type f0_1 = CheckType<Flat<t, undefined>, t>;
29
+ *
30
+ * type f1 = CheckType<
31
+ * Flat<t>,
32
+ * {
33
+ * v: () => Buffer,
34
+ * z: bigint;
35
+ * n: string;
36
+ * a: string;
37
+ * b: number;
38
+ * c: {
39
+ * d: boolean;
40
+ * };
41
+ * w: () => string,
42
+ * }
43
+ * >;
44
+ *
45
+ * type f2 = CheckType<
46
+ * Flat<t, 2>,
47
+ * {
48
+ * v: () => Buffer;
49
+ * z: bigint;
50
+ * n: string;
51
+ * a: string;
52
+ * b: number;
53
+ * d: boolean;
54
+ * w: () => string,
55
+ * }
56
+ * >;
57
+ */
58
+ export type Flat<T, Depth extends number = 1> = T extends undefined ? undefined : Depth extends undefined | 0 ? T : Structure.Separate<T> extends readonly [infer P, infer S] ? _Flat<Depth, P, S> : T;
59
+ export {};
60
+ }
@@ -0,0 +1,22 @@
1
+ declare namespace AVStantso.TS {
2
+ /**
3
+ * @summary Select `TExtended` type or `TBase` if `TExtended` is `undefined` or `TElse`
4
+ */
5
+ type IfDef<TBase, TExtended extends TBase, TElse = TBase> = TExtended extends TBase ? TExtended : TElse;
6
+ /**
7
+ * @summary Select `TExtended[TKey]` type or `TBase[TKey]` if `TExtended[TKey]` is `undefined` or `TElse`
8
+ * @example
9
+ * type A = {
10
+ * x?: number;
11
+ * y?: number;
12
+ * };
13
+ *
14
+ * type B = {
15
+ * x?: 1 | 2 | 3;
16
+ * };
17
+ *
18
+ * type x = CheckType<IfDefKey<'x', A, B>, 1 | 2 | 3>;
19
+ * type y = CheckType<IfDefKey<'y', A, B>, number>;
20
+ */
21
+ type IfDefKey<TKey extends keyof TBase, TBase extends object, TExtended extends TBase, TElse = TBase[TKey]> = IfDef<TBase[TKey], TExtended[TKey], TElse>;
22
+ }
@@ -0,0 +1,9 @@
1
+ import './alt';
2
+ import './flat';
3
+ import './if-def';
4
+ import './opaque';
5
+ import './options';
6
+ import './override';
7
+ import './replace-key';
8
+ import './required-optional';
9
+ import './merge';
@@ -0,0 +1,29 @@
1
+ declare namespace AVStantso.TS {
2
+ /**
3
+ * @summary Merge types. Combine fields for objects, union for others
4
+ * @example
5
+ * type u = CheckType<Merge<number, string>, number | string>;
6
+ * type o = CheckType<
7
+ * Merge<{ a?: number; b?: string }, { a: string }>,
8
+ * { a: string; b?: string }
9
+ * >;
10
+ */
11
+ type Merge<Base, Extended> = Base extends object ? Extended extends object ? {
12
+ [K in keyof (Base & Extended)]: K extends keyof Extended ? Extended[K] : K extends keyof Base ? Base[K] : never;
13
+ } : never : Base | Extended;
14
+ namespace Merge {
15
+ /**
16
+ * @summary Merge fields of object types. Combine fields for objects, union for others
17
+ * @example
18
+ * type a = CheckType<
19
+ * Merge.Fields<{ a?: number; b?: string }, { a: string }, 'a'>,
20
+ * number | string
21
+ * >;
22
+ * type b = CheckType<
23
+ * Merge.Fields<{ a?: number; b?: string }, { a: string }, 'b', 'a'>,
24
+ * string
25
+ * >;
26
+ */
27
+ type Fields<Base extends object, Extended extends object, BaseKey extends Key, ExtendedKey extends Key = BaseKey> = BaseKey extends keyof Base ? ExtendedKey extends keyof Extended ? Merge<Base[BaseKey], Extended[ExtendedKey]> : Base[BaseKey] : never;
28
+ }
29
+ }
@@ -0,0 +1,17 @@
1
+ declare namespace AVStantso.TS {
2
+ /**
3
+ * @summary Opaque type without direct asignment
4
+ * @see https://stackoverflow.com/questions/56720355/typescript-type-string-of-specific-characters
5
+ * @example
6
+ * type ID = Opaque<'ID', string>;
7
+ *
8
+ * //@ts-expect-error Type 'string' is not assignable to type 'ID'.
9
+ * const id1: ID = 'abc';
10
+ * const id2: ID = 'def' as ID;
11
+ *
12
+ * const s: string = id1 + id2;
13
+ */
14
+ type Opaque<TypeMeta, T> = T & {
15
+ __META__: TypeMeta;
16
+ };
17
+ }
@@ -0,0 +1,34 @@
1
+ declare namespace AVStantso.TS {
2
+ /**
3
+ * @summary Options for type declaration
4
+ * @template TTypeMap All available options
5
+ * @template TDefaults Default values for options
6
+ */
7
+ type Options<TTypeMap extends object, TDefaults extends Partial<TTypeMap> = undefined> = {
8
+ TypeMap: Partial<TTypeMap>;
9
+ Defaults: Partial<TDefaults>;
10
+ };
11
+ namespace Options {
12
+ /**
13
+ * @summary Structure of options for type declaration
14
+ */
15
+ type Structure = {
16
+ TypeMap: object;
17
+ Defaults: object;
18
+ };
19
+ /**
20
+ * @summary Get option from options or default
21
+ */
22
+ type Get<TOptionsStructure extends Options.Structure, TOptions extends TOptionsStructure['TypeMap'], TKey extends keyof TOptionsStructure['TypeMap'], TDefault extends TOptionsStructure['TypeMap'][TKey] = TOptionsStructure['Defaults'][TKey] extends TOptionsStructure['TypeMap'][TKey] ? TOptionsStructure['Defaults'][TKey] : undefined> = TOptions extends undefined ? TDefault : TOptions[TKey] extends undefined ? TDefault : TOptions[TKey];
23
+ /**
24
+ * @summary Apply defaults from structure
25
+ */
26
+ type Apply<TOptionsStructure extends Options.Structure, TOptions extends TOptionsStructure['TypeMap']> = {
27
+ [K in keyof TOptionsStructure['TypeMap']]: Get<TOptionsStructure, TOptions, K>;
28
+ };
29
+ /**
30
+ * @summary Check `TOptions` satisfy the `TOptionsStructure`
31
+ */
32
+ type Check<TOptionsStructure extends Options.Structure, TOptions extends TOptionsStructure['TypeMap']> = TOptions;
33
+ }
34
+ }
@@ -0,0 +1,100 @@
1
+ declare namespace AVStantso.TS {
2
+ /**
3
+ * @summary Override `TBase` properties by `TExtended` properties if `TExtended[K]` is NOT `undefined`
4
+ * or `never` for all `TBase` keys
5
+ * @example
6
+ * type A = {
7
+ * x?: number;
8
+ * y?: number;
9
+ * z?: number;
10
+ * };
11
+ *
12
+ * type B = {
13
+ * x?: 1 | 2 | 3;
14
+ * y?: 12
15
+ * };
16
+ *
17
+ * type R = CheckType<Override<A, B>, { x?: 1 | 2 | 3; y?: 12; z?: number; }>;
18
+ */
19
+ type Override<TBase extends object, TExtended extends TBase, TOptional extends boolean = false> = TOptional extends true ? {
20
+ [K in keyof TBase]?: IfDefKey<K, TBase, TExtended>;
21
+ } : {
22
+ [K in keyof TBase]: IfDefKey<K, TBase, TExtended>;
23
+ };
24
+ /**
25
+ * @summary Test `TBase` was overrided by `TCurrent`
26
+ * @example
27
+ * type A = CheckType<IfIsOverrided<number, 1 | 2 | 3>, true>;
28
+ * type B = CheckType<IfIsOverrided<number, number>, false>;
29
+ * type C = CheckType<IfIsOverrided<unknown, unknown>, false>;
30
+ * type D = CheckType<IfIsOverrided<unknown, {}>, true>;
31
+ */
32
+ type IfIsOverrided<TBase, TCurrent extends TBase, IfTrue = true, IfFalse = false> = TBase extends TCurrent ? TCurrent extends object ? TCurrent extends TBase ? IfTrue : IfFalse : IfFalse : IfTrue;
33
+ /**
34
+ * @summary Test `TBase[Key]` was overrided by `TCurrent[Key]`
35
+ * @example
36
+ * type A = CheckType<
37
+ * IfIsOverridedKey<'a', { a: number; b: string }, { a: 1 | 2 | 3, b: string }>,
38
+ * true
39
+ * >;
40
+ *
41
+ * type B = CheckType<
42
+ * IfIsOverridedKey<'a', { a: number; b: string }, { a: number, b: string }>,
43
+ * false
44
+ * >;
45
+ */
46
+ type IfIsOverridedKey<TKey extends keyof TBase, TBase, TCurrent extends TBase, IfTrue = true, IfFalse = false> = IfIsOverrided<TBase[TKey], TCurrent[TKey], IfTrue, IfFalse>;
47
+ /**
48
+ * @summary Select `TExtended` type if `TBase` and `TCurrent` is equals
49
+ * @example
50
+ * type A = CheckType<IfNotOverrided<number, 1 | 2 | 3, 2>, 1 | 2 | 3>;
51
+ * type B = CheckType<IfNotOverrided<number, number, 4>, 4>;
52
+ * type C = CheckType<IfNotOverrided<unknown, unknown, 'A!'>, 'A!'>;
53
+ */
54
+ type IfNotOverrided<TBase, TCurrent extends TBase, TExtended extends TBase> = IfIsOverrided<TBase, TCurrent, TCurrent, TExtended>;
55
+ /**
56
+ * @summary Select `TExtended[TKey]` if `TBase[TKey]` and `TCurrent[TKey]` is equals
57
+ * @example
58
+ * type A = CheckType<
59
+ * IfNotOverridedKey<'a', { a: number }, { a: 1 | 2 | 3 }, { a: 2 } >,
60
+ * 1 | 2 | 3
61
+ * >;
62
+ */
63
+ type IfNotOverridedKey<TKey extends keyof TBase, TBase, TCurrent extends TBase, TExtended extends TBase> = IfDef<TBase[TKey], IfNotOverrided<TBase[TKey], TCurrent[TKey], TExtended[TKey]>>;
64
+ /**
65
+ * @summary Override `TCurrent` properties by `TExtended` properties if `TCurrent[K]` equals `TBase[K]`
66
+ * @example
67
+ * type A = {
68
+ * a?: string;
69
+ * b?: string;
70
+ * x?: number;
71
+ * y?: number;
72
+ * z?: number;
73
+ * };
74
+ *
75
+ * type B = {
76
+ * x?: 1 | 2 | 3;
77
+ * y?: 12;
78
+ * };
79
+ *
80
+ * type C = {
81
+ * b: 'b' | 'bb';
82
+ * x?: 4;
83
+ * z?: 72;
84
+ * };
85
+ *
86
+ * type R = CheckType<
87
+ * OverrideIfNot<A, B, C>,
88
+ * { a?: string;
89
+ * b?: 'b' | 'bb';
90
+ * x?: 1 | 2 | 3;
91
+ * y?: 12;
92
+ * z?: 72; }
93
+ * >;
94
+ */
95
+ type OverrideIfNot<TBase extends object, TCurrent extends TBase, TExtended extends TBase, TOptional extends boolean = false> = TOptional extends true ? {
96
+ [K in keyof TBase]?: IfNotOverridedKey<K, TBase, TCurrent, TExtended>;
97
+ } : {
98
+ [K in keyof TBase]: IfNotOverridedKey<K, TBase, TCurrent, TExtended>;
99
+ };
100
+ }
@@ -0,0 +1,33 @@
1
+ declare namespace AVStantso.TS {
2
+ type _ReplaceKey<TKey extends keyof TBase, TBase extends object, TReplacement, TOptional extends boolean = false, R = Omit<TBase, TKey> & (TOptional extends true ? {
3
+ [K in TKey]?: TReplacement;
4
+ } : {
5
+ [K in TKey]: TReplacement;
6
+ })> = {
7
+ [K in keyof R]: R[K];
8
+ };
9
+ /**
10
+ * @summary Replace key `TKey` in object or function `TBase` for `TReplacement`
11
+ * @example
12
+ * type r1 = CheckType<
13
+ * ReplaceKey<'a', { a: string; b: number }, []>,
14
+ * { a: [], b: number }
15
+ * >;
16
+ *
17
+ * type r2 = CheckType<
18
+ * ReplaceKey<'a', { a: string; b: number }, [], true>,
19
+ * { a?: [], b: number }
20
+ * >;
21
+ */
22
+ export type ReplaceKey<TKey extends keyof TBase, TBase extends object, TReplacement, TOptional extends boolean = false> = _ReplaceKey<TKey, TBase, TReplacement, TOptional>;
23
+ /**
24
+ * @summary Replace key `TKey` in object or function `TBase` for `TReplacement` optionally
25
+ * @example
26
+ * type r1 = CheckType<
27
+ * ReplaceKeyOpt<'a', { a: string; b: number }, []>,
28
+ * { a?: [], b: number }
29
+ * >;
30
+ */
31
+ export type ReplaceKeyOpt<TKey extends keyof TBase, TBase extends object, TReplacement> = ReplaceKey<TKey, TBase, TReplacement, true>;
32
+ export {};
33
+ }
@@ -0,0 +1,24 @@
1
+ declare namespace AVStantso.TS {
2
+ /**
3
+ * @summary Get list of required keys
4
+ * @example
5
+ * type n = CheckType<RequiredKeys<never>, never>;
6
+ * type u = CheckType<RequiredKeys<undefined>, never>;
7
+ *
8
+ * type rk = CheckType<RequiredKeys<{ a: 1, b?: 2 }>, 'a'>;
9
+ */
10
+ type RequiredKeys<T> = {
11
+ [K in keyof T]-?: object extends Pick<T, K> ? never : K;
12
+ }[keyof T];
13
+ /**
14
+ * @summary Get list of optional keys
15
+ * @example
16
+ * type n = CheckType<OptionalKeys<never>, never>;
17
+ * type u = CheckType<OptionalKeys<undefined>, never>;
18
+ *
19
+ * type ok = CheckType<OptionalKeys<{ a: 1, b?: 2 }>, 'b'>;
20
+ */
21
+ type OptionalKeys<T> = {
22
+ [K in keyof T]-?: object extends Pick<T, K> ? K : never;
23
+ }[keyof T];
24
+ }
@@ -0,0 +1 @@
1
+ import './object';
@@ -0,0 +1,23 @@
1
+ declare interface ObjectConstructor {
2
+ /**
3
+ * Returns typed the names of the enumerable string properties and methods of an object.
4
+ * @param o — Object that contains the properties and methods.
5
+ * This can be an object that you created
6
+ * or an existing Document Object Model (DOM) object.
7
+ */
8
+ keysEx<O extends object>(o: O): AVStantso.TS.Structure.ToKeysArray<O>;
9
+ /**
10
+ * Returns an array of typed values of the enumerable own properties of an object
11
+ * @param o — Object that contains the properties and methods.
12
+ * This can be an object that you created
13
+ * or an existing Document Object Model (DOM) object.
14
+ */
15
+ valuesEx<O extends object>(o: O): AVStantso.TS.Structure.ToValuesArray<O>;
16
+ /**
17
+ * Returns an array of typed key/values of the enumerable own properties of an object
18
+ * @param o — Object that contains the properties and methods.
19
+ * This can be an object that you created
20
+ * or an existing Document Object Model (DOM) object.
21
+ */
22
+ entriesEx<O extends object>(o: O): AVStantso.TS.Structure.ToEntriesArray<O>;
23
+ }
@@ -0,0 +1,2 @@
1
+ import TS = AVStantso.TS;
2
+ export { TS };
@@ -0,0 +1,4 @@
1
+ import '@avstantso/core';
2
+ import './_global';
3
+ import './_std-ext';
4
+ export * from './export';