Comparing version 0.0.1-16 to 0.0.1-17
import type { ArrayType, AtomicType, Denominalize, IntersectionType, ObjectType, OptionalType, RecordType, RecursiveType, RefinedType, TupleType, Type, UnionType, __nominal, __type } from './type'; | ||
export declare const hasOwnProperty: (v: PropertyKey) => boolean; | ||
export declare const toString: () => string; | ||
export declare type __MediumTypeOf<TType, TMediumTypes> = TType extends ObjectType<infer TDefinition> ? __ObjectTypeDefinitionToMediumType<TDefinition, TMediumTypes> : TType extends RecordType<infer TKey, infer TValue> ? Record<__MediumTypeOfRecordKeyType<TKey, TMediumTypes>, __MediumTypeOf<TValue, TMediumTypes>> : TType extends ArrayType<infer TElementType> ? __MediumTypeOf<TElementType, TMediumTypes>[] : TType extends TupleType<infer TTuple> ? __TupleMediumType<TTuple, TMediumTypes> : TType extends RefinedType<infer TType, infer TRefinement, infer TNominal> ? __RefinedMediumType<TType, TRefinement, TNominal, TMediumTypes> : TType extends AtomicType<infer TTypeSymbol> ? __AtomicMediumType<TTypeSymbol, TMediumTypes> : TType extends UnionType<infer TTypeTuple> ? __MediumTypeOf<TTypeTuple[number], TMediumTypes> : TType extends IntersectionType<infer TTypeTuple> ? __UnionToIntersection<__MediumTypeOf<TTypeTuple[number], TMediumTypes>> : TType extends OptionalType<infer TType> ? __MediumTypeOf<TType, TMediumTypes> | undefined : TType extends RecursiveType<infer TType> ? __MediumTypeOf<TType, TMediumTypes> : unknown; | ||
export declare type __MediumTypeOf<TType, TMediumTypes> = TType extends ObjectType<infer TDefinition> ? __ObjectTypeDefinitionToMediumType<TDefinition, TMediumTypes> : TType extends RecordType<infer TKey, infer TValue> ? Record<__MediumTypeOfRecordKeyType<TKey, TMediumTypes>, __MediumTypeOf<TValue, TMediumTypes>> : TType extends ArrayType<infer TElementType> ? __MediumTypeOf<TElementType, TMediumTypes>[] : TType extends TupleType<infer TTuple> ? __TupleMediumType<TTuple, TMediumTypes> : TType extends RefinedType<infer TType, infer TRefinement, infer TNominal> ? __RefinedMediumType<TType, TRefinement, TNominal, TMediumTypes> : TType extends AtomicType<infer TTypeSymbol> ? __AtomicMediumType<TTypeSymbol, TMediumTypes> : TType extends UnionType<infer TTypeTuple> ? __MediumTypeOf<TTypeTuple[number], TMediumTypes> : TType extends IntersectionType<infer TTypeTuple> ? __UnionToIntersection<__MediumTypeOf<TTypeTuple[number], TMediumTypes>> : TType extends RecursiveType<infer T> ? __RecursiveMediumType<T, TMediumTypes> : TType extends OptionalType<infer TType> ? __MediumTypeOf<TType, TMediumTypes> | undefined : unknown; | ||
export declare type __ObjectTypeDefinitionToMediumType<TDefinition, TMediumTypes> = { | ||
@@ -37,8 +37,8 @@ [TKey in __KeyOfOptional<TDefinition>]?: TDefinition[TKey] extends OptionalType<infer TNestedType> ? __MediumTypeOf<TNestedType, TMediumTypes> : never; | ||
export declare type __RefinedType<TType extends Type, TNominalOrRefinement, TNominal> = RefinedType<TType, TNominalOrRefinement extends __NominalPartial ? unknown : TNominalOrRefinement, TNominalOrRefinement extends __NominalPartial ? TNominalOrRefinement : TNominal>; | ||
export declare type __RecursiveMediumType<T, TMediumTypes> = T extends Type ? __MediumTypeOf<T, TMediumTypes> : { | ||
[TKey in keyof T]: __RecursiveMediumType<T[TKey], TMediumTypes>; | ||
}; | ||
export declare type __NominalPartial = { | ||
[TNominalSymbol in typeof __nominal]: unknown; | ||
}; | ||
export declare type __CleanUpType<T> = { | ||
[TKey in keyof T]: T[TKey]; | ||
}; | ||
export declare function merge(partials: unknown[]): unknown; |
@@ -1,16 +0,16 @@ | ||
import type { __ElementOrArray, __MediumTypeOf, __MediumTypesPackedType, __RefinedType } from '../@internal'; | ||
import type { __ElementOrArray, __MediumTypesPackedType, __RecursiveMediumType, __RefinedType } from '../@internal'; | ||
import type { Medium } from '../medium'; | ||
import type { TypeConstraint, TypeOf } from './type'; | ||
import type { TypeConstraint } from './type'; | ||
import { Type } from './type'; | ||
export interface RecursiveType<TType> { | ||
refine<TNominalOrRefinement, TNominal = unknown>(constraints: __ElementOrArray<TypeConstraint<TypeOf<TType>>>): __RefinedType<this, TNominalOrRefinement, TNominal>; | ||
decode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: __MediumTypesPackedType<TMediumTypes, __MediumTypeOf<TType, TMediumTypes>>): TypeOf<TType>; | ||
encode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: TypeOf<TType>): __MediumTypesPackedType<TMediumTypes, __MediumTypeOf<TType, TMediumTypes>>; | ||
transform<TFromMediumTypes extends object, TToMediumTypes extends object>(from: Medium<TFromMediumTypes>, to: Medium<TToMediumTypes>, value: __MediumTypesPackedType<TFromMediumTypes, __MediumTypeOf<TType, TFromMediumTypes>>): __MediumTypesPackedType<TToMediumTypes, __MediumTypeOf<TType, TToMediumTypes>>; | ||
is(value: unknown): value is TypeOf<TType>; | ||
export interface RecursiveType<T> { | ||
refine<TNominalOrRefinement, TNominal = unknown>(constraints: __ElementOrArray<TypeConstraint<__RecursiveMediumType<T, XValue.Types>>>): __RefinedType<this, TNominalOrRefinement, TNominal>; | ||
decode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: __MediumTypesPackedType<TMediumTypes, __RecursiveMediumType<T, TMediumTypes>>): __RecursiveMediumType<T, XValue.Types>; | ||
encode<TMediumTypes extends object>(medium: Medium<TMediumTypes>, value: __RecursiveMediumType<T, XValue.Types>): __MediumTypesPackedType<TMediumTypes, __RecursiveMediumType<T, TMediumTypes>>; | ||
transform<TFromMediumTypes extends object, TToMediumTypes extends object>(from: Medium<TFromMediumTypes>, to: Medium<TToMediumTypes>, value: __MediumTypesPackedType<TFromMediumTypes, __RecursiveMediumType<T, TFromMediumTypes>>): __MediumTypesPackedType<TToMediumTypes, __RecursiveMediumType<T, TToMediumTypes>>; | ||
is(value: unknown): value is __RecursiveMediumType<T, XValue.Types>; | ||
} | ||
export declare class RecursiveType<TType extends Type> extends Type<'recursive'> { | ||
readonly Type: TType; | ||
constructor(recursion: (Type: RecursiveType<TType>) => TType); | ||
export declare class RecursiveType<T> extends Type<'recursive'> { | ||
readonly Type: Type; | ||
constructor(recursion: (Type: RecursiveType<T>) => Type); | ||
} | ||
export declare function recursive(recursion: (Type: RecursiveType<Type>) => Type): RecursiveType<Type>; | ||
export declare function recursive<T>(recursion: (Type: RecursiveType<T>) => Type): RecursiveType<T>; |
{ | ||
"name": "x-value", | ||
"version": "0.0.1-16", | ||
"version": "0.0.1-17", | ||
"repository": "https://github.com/vilic/x-value.git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -43,6 +43,6 @@ import type { | ||
? __UnionToIntersection<__MediumTypeOf<TTypeTuple[number], TMediumTypes>> | ||
: TType extends RecursiveType<infer T> | ||
? __RecursiveMediumType<T, TMediumTypes> | ||
: TType extends OptionalType<infer TType> | ||
? __MediumTypeOf<TType, TMediumTypes> | undefined | ||
: TType extends RecursiveType<infer TType> | ||
? __MediumTypeOf<TType, TMediumTypes> | ||
: unknown; | ||
@@ -154,2 +154,8 @@ | ||
export type __RecursiveMediumType<T, TMediumTypes> = T extends Type | ||
? __MediumTypeOf<T, TMediumTypes> | ||
: { | ||
[TKey in keyof T]: __RecursiveMediumType<T[TKey], TMediumTypes>; | ||
}; | ||
export type __NominalPartial = { | ||
@@ -159,6 +165,2 @@ [TNominalSymbol in typeof __nominal]: unknown; | ||
export type __CleanUpType<T> = { | ||
[TKey in keyof T]: T[TKey]; | ||
}; | ||
export function merge(partials: unknown[]): unknown { | ||
@@ -165,0 +167,0 @@ let pendingMergeKeyToValues: Map<string | number, unknown[]> | undefined; |
@@ -5,2 +5,3 @@ import type { | ||
__MediumTypesPackedType, | ||
__RecursiveMediumType, | ||
__RefinedType, | ||
@@ -10,8 +11,10 @@ } from '../@internal'; | ||
import type {TypeConstraint, TypeIssue, TypeOf, TypePath} from './type'; | ||
import type {TypeConstraint, TypeIssue, TypePath} from './type'; | ||
import {Type} from './type'; | ||
export interface RecursiveType<TType> { | ||
export interface RecursiveType<T> { | ||
refine<TNominalOrRefinement, TNominal = unknown>( | ||
constraints: __ElementOrArray<TypeConstraint<TypeOf<TType>>>, | ||
constraints: __ElementOrArray< | ||
TypeConstraint<__RecursiveMediumType<T, XValue.Types>> | ||
>, | ||
): __RefinedType<this, TNominalOrRefinement, TNominal>; | ||
@@ -23,10 +26,13 @@ | ||
TMediumTypes, | ||
__MediumTypeOf<TType, TMediumTypes> | ||
__RecursiveMediumType<T, TMediumTypes> | ||
>, | ||
): TypeOf<TType>; | ||
): __RecursiveMediumType<T, XValue.Types>; | ||
encode<TMediumTypes extends object>( | ||
medium: Medium<TMediumTypes>, | ||
value: TypeOf<TType>, | ||
): __MediumTypesPackedType<TMediumTypes, __MediumTypeOf<TType, TMediumTypes>>; | ||
value: __RecursiveMediumType<T, XValue.Types>, | ||
): __MediumTypesPackedType< | ||
TMediumTypes, | ||
__RecursiveMediumType<T, TMediumTypes> | ||
>; | ||
@@ -38,16 +44,16 @@ transform<TFromMediumTypes extends object, TToMediumTypes extends object>( | ||
TFromMediumTypes, | ||
__MediumTypeOf<TType, TFromMediumTypes> | ||
__RecursiveMediumType<T, TFromMediumTypes> | ||
>, | ||
): __MediumTypesPackedType< | ||
TToMediumTypes, | ||
__MediumTypeOf<TType, TToMediumTypes> | ||
__RecursiveMediumType<T, TToMediumTypes> | ||
>; | ||
is(value: unknown): value is TypeOf<TType>; | ||
is(value: unknown): value is __RecursiveMediumType<T, XValue.Types>; | ||
} | ||
export class RecursiveType<TType extends Type> extends Type<'recursive'> { | ||
readonly Type: TType; | ||
export class RecursiveType<T> extends Type<'recursive'> { | ||
readonly Type: Type; | ||
constructor(recursion: (Type: RecursiveType<TType>) => TType) { | ||
constructor(recursion: (Type: RecursiveType<T>) => Type) { | ||
super(); | ||
@@ -101,6 +107,6 @@ | ||
export function recursive( | ||
recursion: (Type: RecursiveType<Type>) => Type, | ||
): RecursiveType<Type> { | ||
export function recursive<T>( | ||
recursion: (Type: RecursiveType<T>) => Type, | ||
): RecursiveType<T> { | ||
return new RecursiveType(recursion); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
195685
4150