@bemedev/typings 1.0.0 → 1.1.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/lib/helpers/custom.d.ts +1 -1
- package/lib/helpers/index.d.ts +19 -19
- package/lib/helpers/use.d.ts +1 -1
- package/lib/standard.d.ts +1 -1
- package/lib/standard.types.d.ts +2 -2
- package/lib/type.d.ts +2 -2
- package/lib/types.d.ts +15 -9
- package/lib/utils/_const.d.ts +1 -1
- package/lib/utils/index.d.ts +3 -3
- package/lib/utils/isSh.d.ts +1 -1
- package/package.json +1 -1
package/lib/helpers/custom.d.ts
CHANGED
package/lib/helpers/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
1
|
+
export * from './any';
|
|
2
|
+
export * from './array';
|
|
3
|
+
export * from './custom';
|
|
4
|
+
export * from './intersection';
|
|
5
|
+
export * from './use';
|
|
6
|
+
export * from './litterals';
|
|
7
|
+
export * from './optional';
|
|
8
|
+
export * from './partial';
|
|
9
|
+
export * from './primitive';
|
|
10
|
+
export * from './primitiveObject';
|
|
11
|
+
export * from './readonly';
|
|
12
|
+
export * from './record';
|
|
13
|
+
export * from './soa';
|
|
14
|
+
export * from './sora';
|
|
15
|
+
export * from './sv';
|
|
16
|
+
export * from './tuple';
|
|
17
|
+
export * from './union';
|
|
18
|
+
export * from './object';
|
|
19
|
+
export * from './omit';
|
package/lib/helpers/use.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Sh } from
|
|
1
|
+
import type { Sh } from '../types';
|
|
2
2
|
export declare const use: <T extends Sh>({ __type }: T) => T["__type"];
|
package/lib/standard.d.ts
CHANGED
package/lib/standard.types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { StandardSchemaV1 } from
|
|
2
|
-
export type * from
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export type * from '@standard-schema/spec';
|
|
3
3
|
export type StandardKey = keyof StandardSchemaV1;
|
package/lib/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { inferSh, ObjectT } from
|
|
2
|
-
import { any, array, custom, intersection, litterals, object, omit, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union, sora, use } from
|
|
1
|
+
import type { inferSh, ObjectT } from './types';
|
|
2
|
+
import { any, array, custom, intersection, litterals, object, omit, optional, partial, primitive, primitiveObject, readonly, record, soa, sv, tuple, union, sora, use } from './helpers';
|
|
3
3
|
type Helpers = {
|
|
4
4
|
any: typeof any;
|
|
5
5
|
custom: typeof custom;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, UNION } from "./constants";
|
|
2
|
-
import type {
|
|
1
|
+
import type { ARRAY, CUSTOM, OPTIONAL, PARTIAL, PRIMITIVES, PRIMITIVE_OBJECTS, SOA, SORA, STANDARD_KEY, UNION } from "./constants";
|
|
2
|
+
import type { StandardSchemaV1 } from "./standard.types";
|
|
3
3
|
export type Ru = Record<Keys, unknown>;
|
|
4
4
|
type Equals<T, U> = T extends U ? (U extends T ? true : false) : false;
|
|
5
5
|
export type TrueObject = Ru & {
|
|
@@ -87,9 +87,6 @@ type ReduceTupleU<T extends AnyArray> = T extends [
|
|
|
87
87
|
] ? [Undefiny<First>, ...ReduceTupleU<Rest>] : T[number] extends never ? [] : T["length"] extends 0 ? [] : number extends T["length"] ? T : Undefiny<T[number]>[];
|
|
88
88
|
type EmptyObject = {};
|
|
89
89
|
type __TransformUnion<T extends UnionCustom> = T extends UnionCustom<infer TCustom> ? Omit<T, typeof UNION> extends infer Ot ? Equals<Ot, EmptyObject> extends true ? TransformT<TCustom[number]> : TransformT<TCustom[number]> & TransformT<Ot> : never : never;
|
|
90
|
-
type __TransformPrimitiveObject<T> = Equals<ObjectMapS, T> extends true ? object : T extends Types ? TransformTypes<T> : T extends ArrayCustom<infer A> ? TransformT<A>[] : T extends UnionCustom ? __TransformUnion<T> : T extends SoRaCustom<infer TSoA> ? SoRa<__TransformPrimitiveObject<TSoA>> : T extends SoaCustom<infer TSoA> ? SoA<__TransformPrimitiveObject<TSoA>> : T extends Custom<infer TCustom> ? TCustom : T extends AnyArray<ObjectT> ? ReduceTuple2<T> : T extends PartialCustom<infer TPartial> ? Partial<__TransformPrimitiveObject<TPartial>> : T extends Optional<infer TOptional> ? __TransformPrimitiveObject<TOptional> | OptionalHelperClass : {
|
|
91
|
-
[K in keyof T]: __TransformPrimitiveObject<T[K]>;
|
|
92
|
-
};
|
|
93
90
|
type HasUndefined<T> = unknown extends T ? false : OptionalHelperClass extends T ? true : false;
|
|
94
91
|
type UndefinyObject<T extends object> = {
|
|
95
92
|
[K in keyof T as HasUndefined<T[K]> extends true ? never : K]: Undefiny<T[K]>;
|
|
@@ -99,17 +96,26 @@ type UndefinyObject<T extends object> = {
|
|
|
99
96
|
[K in keyof F]: F[K];
|
|
100
97
|
} : never;
|
|
101
98
|
type Undefiny<T, U = Exclude<T, OptionalHelperClass>> = U extends AnyArray ? ReduceTupleU<U> : U extends Ru ? UndefinyObject<U> : U;
|
|
102
|
-
type
|
|
99
|
+
type __TransformPrimitiveObject<T> = Equals<ObjectMapS, T> extends true ? object : T extends Types ? TransformTypes<T> : T extends ArrayCustom<infer A> ? TransformT<A>[] : T extends UnionCustom ? __TransformUnion<T> : T extends SoRaCustom<infer TSoA> ? SoRa<__TransformPrimitiveObject<TSoA>> : T extends SoaCustom<infer TSoA> ? SoA<__TransformPrimitiveObject<TSoA>> : T extends Custom<infer TCustom> ? TCustom : T extends AnyArray<ObjectT> ? ReduceTuple2<T> : T extends PartialCustom<infer TPartial> ? Partial<__TransformPrimitiveObject<TPartial>> : T extends Optional<infer TOptional> ? __TransformPrimitiveObject<TOptional> | OptionalHelperClass : Undefiny<{
|
|
100
|
+
[K in keyof T]: __TransformPrimitiveObject<T[K]>;
|
|
101
|
+
}>;
|
|
102
|
+
type TransformT<T> = __TransformPrimitiveObject<T>;
|
|
103
103
|
export type StandardHelper<T1 = any, T2 = any> = {
|
|
104
104
|
__type: T1;
|
|
105
105
|
type: T2;
|
|
106
106
|
} & StandardSchemaV1<T2, T2>;
|
|
107
107
|
type _Sh<T1 = any, T2 = any> = StandardHelper<T1, T2>;
|
|
108
108
|
export type Sh<T extends ObjectT = ObjectT> = StandardHelper<T, inferO<T>>;
|
|
109
|
-
export type StandardOutput<T = any> =
|
|
110
|
-
|
|
109
|
+
export type StandardOutput<T = any> = {
|
|
110
|
+
[STANDARD_KEY]: {
|
|
111
|
+
types?: {
|
|
112
|
+
output: T;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export type inferO<T extends ObjectT = ObjectT> = ObjectT extends T ? unknown : T extends Optional<infer U> ? TransformT<U> | undefined : TransformT<T>;
|
|
111
117
|
export type inferSh<T extends ObjectT = ObjectT> = _Sh<T, inferO<T>>;
|
|
112
|
-
export type inferT<T extends StandardOutput = StandardOutput> = Exclude<T[
|
|
118
|
+
export type inferT<T extends StandardOutput = StandardOutput> = Exclude<T[typeof STANDARD_KEY]["types"], undefined>["output"];
|
|
113
119
|
export type ProduceObject<T extends ObjectT = ObjectT> = T;
|
|
114
120
|
export type FnBasic<Main extends Fn, Tr extends object> = Tr & Main;
|
|
115
121
|
export * from "./standard.types";
|
package/lib/utils/_const.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ObjectT } from
|
|
1
|
+
import type { ObjectT } from '../types';
|
|
2
2
|
export declare const _const: <T extends ObjectT>(value?: T) => T;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './_const';
|
|
2
|
+
export * from './expandFn';
|
|
3
|
+
export * from './isSh';
|
package/lib/utils/isSh.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ObjectT, Sh } from
|
|
1
|
+
import type { ObjectT, Sh } from '../types';
|
|
2
2
|
export declare const isSh: <T extends ObjectT = ObjectT>(value: unknown) => value is Sh<T>;
|