Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
canvas
/
node_modules
/
superstruct
/
lib
/
Filename :
utils.d.ts
back
Copy
import { Struct, Infer, Result, Context, Describe } from './struct'; import { Failure } from './error'; /** * Check if a value is a plain object. */ export declare function isPlainObject(value: unknown): value is { [key: string]: any; }; /** * Return a value as a printable string. */ export declare function print(value: any): string; /** * Shifts (removes and returns) the first value from the `input` iterator. * Like `Array.prototype.shift()` but for an `Iterator`. */ export declare function shiftIterator<T>(input: Iterator<T>): T | undefined; /** * Convert a validation result to an iterable of failures. */ export declare function toFailures<T, S>(result: Result, context: Context<T, S>): IterableIterator<Failure>; /** * Check if a type is a tuple. */ export declare type IsTuple<T> = T extends [any] ? T : T extends [any, any] ? T : T extends [any, any, any] ? T : T extends [any, any, any, any] ? T : T extends [any, any, any, any, any] ? T : never; /** * Check if a type is a record type. */ export declare type IsRecord<T> = T extends object ? string extends keyof T ? T : never : never; /** * Check if a type is a generic string type. */ export declare type IsGenericString<T> = T extends string ? string extends T ? T : never : never; /** * Normalize properties of a type that allow `undefined` to make them optional. */ export declare type Optionalize<S extends object> = OmitBy<S, undefined> & Partial<PickBy<S, undefined>>; /** * Omit properties from a type that extend from a specific type. */ export declare type OmitBy<T, V> = Omit<T, { [K in keyof T]: V extends Extract<T[K], V> ? K : never; }[keyof T]>; /** * Pick properties from a type that extend from a specific type. */ export declare type PickBy<T, V> = Pick<T, { [K in keyof T]: V extends Extract<T[K], V> ? K : never; }[keyof T]>; /** * Simplifies a type definition to its most basic representation. */ export declare type Simplify<T> = T extends any[] | Date ? T : { [K in keyof T]: T[K]; } & {}; /** * Assign properties from one type to another, overwriting existing. */ export declare type Assign<T, U> = Simplify<U & Omit<T, keyof U>>; /** * A schema for object structs. */ export declare type ObjectSchema = Record<string, Struct<any, any>>; /** * Infer a type from an object struct schema. */ export declare type ObjectType<S extends ObjectSchema> = Simplify<Optionalize<{ [K in keyof S]: Infer<S[K]>; }>>; /** * Transform an object schema type to represent a partial. */ export declare type PartialObjectSchema<S extends ObjectSchema> = { [K in keyof S]: Struct<Infer<S[K]> | undefined>; }; /** * A schema for any type of struct. */ export declare type StructSchema<T> = [T] extends [string] ? [T] extends [IsGenericString<T>] ? null : EnumSchema<T> : T extends number | boolean | bigint | symbol | undefined | null | Function | Date | Error | RegExp ? null : T extends Map<any, any> ? null : T extends WeakMap<any, any> ? null : T extends Set<any> ? null : T extends WeakSet<any> ? null : T extends Array<infer E> ? T extends IsTuple<T> ? null : Struct<E> : T extends Promise<any> ? null : T extends object ? T extends IsRecord<T> ? null : { [K in keyof T]: Describe<T[K]>; } : null; /** * A schema for enum structs. */ export declare type EnumSchema<T extends string> = { [K in T]: K; }; /** * A schema for tuple structs. */ export declare type TupleSchema<T> = { [K in keyof T]: Struct<T[K]>; }; //# sourceMappingURL=utils.d.ts.map