Socket
Socket
Sign inDemoInstall

@sinclair/typebox

Package Overview
Dependencies
0
Maintainers
1
Versions
307
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.15 to 0.9.16

4

package.json
{
"name": "@sinclair/typebox",
"version": "0.9.15",
"version": "0.9.16",
"description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",

@@ -33,5 +33,5 @@ "keywords": [

"smoke-task": "^1.1.2",
"typescript": "^3.8.3",
"typescript": "^3.9.2",
"typescript-bundle": "^1.0.16"
}
}

@@ -96,13 +96,3 @@ export interface UserDefinedOptions {

export declare type TConstructor = TConstructor8<TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema> | TConstructor7<TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema> | TConstructor6<TSchema, TSchema, TSchema, TSchema, TSchema, TSchema, TSchema> | TConstructor5<TSchema, TSchema, TSchema, TSchema, TSchema, TSchema> | TConstructor4<TSchema, TSchema, TSchema, TSchema, TSchema> | TConstructor3<TSchema, TSchema, TSchema, TSchema> | TConstructor2<TSchema, TSchema, TSchema> | TConstructor1<TSchema, TSchema> | TConstructor0<TSchema>;
export declare type TContract = TFunction | TConstructor | TPromise<any> | TVoid | TUndefined;
export declare type TPromise<T extends TSchema | TVoid | TUndefined> = {
type: 'promise';
item: T;
} & UserDefinedOptions;
export declare type TUndefined = {
type: 'undefined';
} & UserDefinedOptions;
export declare type TVoid = {
type: 'void';
} & UserDefinedOptions;
declare type TContract = TConstructor | TFunction;
export declare type TIntersect8<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, T6 extends TSchema, T7 extends TSchema> = {

@@ -297,6 +287,16 @@ allOf: [T0, T1, T2, T3, T4, T5, T6, T7];

export declare type TAny = {} & UserDefinedOptions;
export declare type TSchema = TLiteral | TNumber | TInteger | TBoolean | TString | TObject<any> | TArray<any> | TEnum<any> | TMap<any> | TNull | TAny;
export declare type TPromise<T extends TSchema | TVoid | TUndefined> = {
type: 'promise';
item: T;
} & UserDefinedOptions;
export declare type TUndefined = {
type: 'undefined';
} & UserDefinedOptions;
export declare type TVoid = {
type: 'void';
} & UserDefinedOptions;
export declare type TSchema = TLiteral | TNumber | TInteger | TBoolean | TString | TObject<any> | TArray<any> | TEnum<any> | TMap<any> | TNull | TAny | TPromise<any> | TUndefined | TVoid;
declare type StaticFunction<T> = T extends TFunction8<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6, infer U7, infer R> ? (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>, arg5: Static<U5>, arg6: Static<U6>, arg7: Static<U7>) => Static<R> : T extends TFunction7<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6, infer R> ? (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>, arg5: Static<U5>, arg6: Static<U6>) => Static<R> : T extends TFunction6<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer R> ? (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>, arg5: Static<U5>) => Static<R> : T extends TFunction5<infer U0, infer U1, infer U2, infer U3, infer U4, infer R> ? (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>) => Static<R> : T extends TFunction4<infer U0, infer U1, infer U2, infer U3, infer R> ? (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>) => Static<R> : T extends TFunction3<infer U0, infer U1, infer U2, infer R> ? (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>) => Static<R> : T extends TFunction2<infer U0, infer U1, infer R> ? (arg0: Static<U0>, arg1: Static<U1>) => Static<R> : T extends TFunction1<infer U0, infer R> ? (arg0: Static<U0>) => Static<R> : T extends TFunction0<infer R> ? () => Static<R> : never;
declare type StaticConstructor<T> = T extends TConstructor8<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6, infer U7, infer R> ? new (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>, arg5: Static<U5>, arg6: Static<U6>, arg7: Static<U7>) => Static<R> : T extends TConstructor7<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6, infer R> ? new (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>, arg5: Static<U5>, arg6: Static<U6>) => Static<R> : T extends TConstructor6<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer R> ? new (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>, arg5: Static<U5>) => Static<R> : T extends TConstructor5<infer U0, infer U1, infer U2, infer U3, infer U4, infer R> ? new (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>, arg4: Static<U4>) => Static<R> : T extends TConstructor4<infer U0, infer U1, infer U2, infer U3, infer R> ? new (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>, arg3: Static<U3>) => Static<R> : T extends TConstructor3<infer U0, infer U1, infer U2, infer R> ? new (arg0: Static<U0>, arg1: Static<U1>, arg2: Static<U2>) => Static<R> : T extends TConstructor2<infer U0, infer U1, infer R> ? new (arg0: Static<U0>, arg1: Static<U1>) => Static<R> : T extends TConstructor1<infer U0, infer R> ? new (arg0: Static<U0>) => Static<R> : T extends TConstructor0<infer R> ? new () => Static<R> : never;
declare type StaticContract<T extends TContract> = T extends TFunction ? StaticFunction<T> : T extends TConstructor ? StaticConstructor<T> : T extends TPromise<infer U> ? Promise<Static<U>> : T extends TVoid ? void : T extends TUndefined ? undefined : never;
declare type StaticContract<T extends TSchema> = T extends TFunction ? StaticFunction<T> : T extends TConstructor ? StaticConstructor<T> : never;
declare type StaticIntersect<T> = T extends TIntersect8<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6, infer U7> ? StaticSchema<U0> & StaticSchema<U1> & StaticSchema<U2> & StaticSchema<U3> & StaticSchema<U4> & StaticSchema<U5> & StaticSchema<U6> & StaticSchema<U7> : T extends TIntersect7<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6> ? StaticSchema<U0> & StaticSchema<U1> & StaticSchema<U2> & StaticSchema<U3> & StaticSchema<U4> & StaticSchema<U5> & StaticSchema<U6> : T extends TIntersect6<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5> ? StaticSchema<U0> & StaticSchema<U1> & StaticSchema<U2> & StaticSchema<U3> & StaticSchema<U4> & StaticSchema<U5> : T extends TIntersect5<infer U0, infer U1, infer U2, infer U3, infer U4> ? StaticSchema<U0> & StaticSchema<U1> & StaticSchema<U2> & StaticSchema<U3> & StaticSchema<U4> : T extends TIntersect4<infer U0, infer U1, infer U2, infer U3> ? StaticSchema<U0> & StaticSchema<U1> & StaticSchema<U2> & StaticSchema<U3> : T extends TIntersect3<infer U0, infer U1, infer U2> ? StaticSchema<U0> & StaticSchema<U1> & StaticSchema<U2> : T extends TIntersect2<infer U0, infer U1> ? StaticSchema<U1> & StaticSchema<U0> : T extends TIntersect1<infer U0> ? StaticSchema<U0> : never;

@@ -317,3 +317,3 @@ declare type StaticUnion<T> = T extends TUnion8<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6, infer U7> ? StaticSchema<U0> | StaticSchema<U1> | StaticSchema<U2> | StaticSchema<U3> | StaticSchema<U4> | StaticSchema<U5> | StaticSchema<U6> | StaticSchema<U7> : T extends TUnion7<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5, infer U6> ? StaticSchema<U0> | StaticSchema<U1> | StaticSchema<U2> | StaticSchema<U3> | StaticSchema<U4> | StaticSchema<U5> | StaticSchema<U6> : T extends TUnion6<infer U0, infer U1, infer U2, infer U3, infer U4, infer U5> ? StaticSchema<U0> | StaticSchema<U1> | StaticSchema<U2> | StaticSchema<U3> | StaticSchema<U4> | StaticSchema<U5> : T extends TUnion5<infer U0, infer U1, infer U2, infer U3, infer U4> ? StaticSchema<U0> | StaticSchema<U1> | StaticSchema<U2> | StaticSchema<U3> | StaticSchema<U4> : T extends TUnion4<infer U0, infer U1, infer U2, infer U3> ? StaticSchema<U0> | StaticSchema<U1> | StaticSchema<U2> | StaticSchema<U3> : T extends TUnion3<infer U0, infer U1, infer U2> ? StaticSchema<U0> | StaticSchema<U1> | StaticSchema<U2> : T extends TUnion2<infer U0, infer U1> ? StaticSchema<U0> | StaticSchema<U1> : T extends TUnion1<infer U0> ? StaticSchema<U0> : never;

declare type PropertyKeys<T> = keyof Omit<T, OptionalPropertyKeys<T> | ReadonlyPropertyKeys<T> | ReadonlyOptionalPropertyKeys<T>>;
declare type StaticObjectPropertiesExpansion<T> = {
declare type StaticObjectProperties<T> = {
readonly [K in ReadonlyOptionalPropertyKeys<T>]?: Static<T[K]>;

@@ -327,9 +327,6 @@ } & {

};
declare type StaticObjectProperties<T> = {
[K in keyof StaticObjectPropertiesExpansion<T>]: StaticObjectPropertiesExpansion<T>[K];
};
declare type StaticSchema<T extends TSchema> = T extends TObject<infer U> ? StaticObjectProperties<U> : T extends TMap<infer U> ? {
[key: string]: Static<U>;
} : T extends TArray<infer U> ? Array<Static<U>> : T extends TEnum<infer U> ? U : T extends TLiteral ? StaticLiteral<T> : T extends TString ? string : T extends TNumber ? number : T extends TInteger ? number : T extends TBoolean ? boolean : T extends TNull ? null : T extends TAny ? any : never;
export declare type TStatic = TComposite | TSchema | TContract | TModifier;
} : T extends TArray<infer U> ? Array<Static<U>> : T extends TEnum<infer U> ? U : T extends TLiteral ? StaticLiteral<T> : T extends TString ? string : T extends TNumber ? number : T extends TInteger ? number : T extends TBoolean ? boolean : T extends TNull ? null : T extends TAny ? any : T extends TPromise<infer U> ? Promise<Static<U>> : T extends TVoid ? void : T extends TUndefined ? undefined : never;
export declare type TStatic = TComposite | TSchema | TModifier | TContract;
export declare type Static<T extends TStatic> = T extends TContract ? StaticContract<T> : T extends TComposite ? StaticComposite<T> : T extends TSchema ? StaticSchema<T> : never;

@@ -392,37 +389,37 @@ export declare class Type {

/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, T5 extends TStatic, T6 extends TStatic, T7 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4, T5, T6, T7], returns: U, options?: UserDefinedOptions): TFunction8<T0, T1, T2, T3, T4, T5, T6, T7, U>;
static Function<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, T6 extends TSchema, T7 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4, T5, T6, T7], returns: U, options?: UserDefinedOptions): TFunction8<T0, T1, T2, T3, T4, T5, T6, T7, U>;
/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, T5 extends TStatic, T6 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4, T5, T6], returns: U, options?: UserDefinedOptions): TFunction7<T0, T1, T2, T3, T4, T5, T6, U>;
static Function<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, T6 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4, T5, T6], returns: U, options?: UserDefinedOptions): TFunction7<T0, T1, T2, T3, T4, T5, T6, U>;
/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, T5 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4, T5], returns: U, options?: UserDefinedOptions): TFunction6<T0, T1, T2, T3, T4, T5, U>;
static Function<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4, T5], returns: U, options?: UserDefinedOptions): TFunction6<T0, T1, T2, T3, T4, T5, U>;
/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4], returns: U, options?: UserDefinedOptions): TFunction5<T0, T1, T2, T3, T4, U>;
static Function<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4], returns: U, options?: UserDefinedOptions): TFunction5<T0, T1, T2, T3, T4, U>;
/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3], returns: U, options?: UserDefinedOptions): TFunction4<T0, T1, T2, T3, U>;
static Function<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3], returns: U, options?: UserDefinedOptions): TFunction4<T0, T1, T2, T3, U>;
/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, U extends TStatic>(args: [T0, T1, T2], returns: U, options?: UserDefinedOptions): TFunction3<T0, T1, T2, U>;
static Function<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, U extends TSchema>(args: [T0, T1, T2], returns: U, options?: UserDefinedOptions): TFunction3<T0, T1, T2, U>;
/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, T1 extends TStatic, U extends TStatic>(args: [T0, T1], returns: U, options?: UserDefinedOptions): TFunction2<T0, T1, U>;
static Function<T0 extends TSchema, T1 extends TSchema, U extends TSchema>(args: [T0, T1], returns: U, options?: UserDefinedOptions): TFunction2<T0, T1, U>;
/** Creates a `function` type for the given arguments. */
static Function<T0 extends TStatic, U extends TStatic>(args: [T0], returns: U, options?: UserDefinedOptions): TFunction1<T0, U>;
static Function<T0 extends TSchema, U extends TSchema>(args: [T0], returns: U, options?: UserDefinedOptions): TFunction1<T0, U>;
/** Creates a `function` type for the given arguments. */
static Function<U extends TStatic>(args: [], returns: U, options?: UserDefinedOptions): TFunction0<U>;
static Function<U extends TSchema>(args: [], returns: U, options?: UserDefinedOptions): TFunction0<U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, T5 extends TStatic, T6 extends TStatic, T7 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4, T5, T6, T7], returns: U, options?: UserDefinedOptions): TConstructor8<T0, T1, T2, T3, T4, T5, T6, T7, U>;
static Constructor<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, T6 extends TSchema, T7 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4, T5, T6, T7], returns: U, options?: UserDefinedOptions): TConstructor8<T0, T1, T2, T3, T4, T5, T6, T7, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, T5 extends TStatic, T6 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4, T5, T6], returns: U, options?: UserDefinedOptions): TConstructor7<T0, T1, T2, T3, T4, T5, T6, U>;
static Constructor<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, T6 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4, T5, T6], returns: U, options?: UserDefinedOptions): TConstructor7<T0, T1, T2, T3, T4, T5, T6, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, T5 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4, T5], returns: U, options?: UserDefinedOptions): TConstructor6<T0, T1, T2, T3, T4, T5, U>;
static Constructor<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, T5 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4, T5], returns: U, options?: UserDefinedOptions): TConstructor6<T0, T1, T2, T3, T4, T5, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, T4 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3, T4], returns: U, options?: UserDefinedOptions): TConstructor5<T0, T1, T2, T3, T4, U>;
static Constructor<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, T4 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3, T4], returns: U, options?: UserDefinedOptions): TConstructor5<T0, T1, T2, T3, T4, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, T3 extends TStatic, U extends TStatic>(args: [T0, T1, T2, T3], returns: U, options?: UserDefinedOptions): TConstructor4<T0, T1, T2, T3, U>;
static Constructor<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, T3 extends TSchema, U extends TSchema>(args: [T0, T1, T2, T3], returns: U, options?: UserDefinedOptions): TConstructor4<T0, T1, T2, T3, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, T1 extends TStatic, T2 extends TStatic, U extends TStatic>(args: [T0, T1, T2], returns: U, options?: UserDefinedOptions): TConstructor3<T0, T1, T2, U>;
static Constructor<T0 extends TSchema, T1 extends TSchema, T2 extends TSchema, U extends TSchema>(args: [T0, T1, T2], returns: U, options?: UserDefinedOptions): TConstructor3<T0, T1, T2, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, T1 extends TStatic, U extends TStatic>(args: [T0, T1], returns: U, options?: UserDefinedOptions): TConstructor2<T0, T1, U>;
static Constructor<T0 extends TSchema, T1 extends TSchema, U extends TSchema>(args: [T0, T1], returns: U, options?: UserDefinedOptions): TConstructor2<T0, T1, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<T0 extends TStatic, U extends TStatic>(args: [T0], returns: U, options?: UserDefinedOptions): TConstructor1<T0, U>;
static Constructor<T0 extends TSchema, U extends TSchema>(args: [T0], returns: U, options?: UserDefinedOptions): TConstructor1<T0, U>;
/** Creates a `constructor` type for the given arguments. */
static Constructor<U extends TStatic>(args: [], returns: U, options?: UserDefinedOptions): TConstructor0<U>;
static Constructor<U extends TSchema>(args: [], returns: U, options?: UserDefinedOptions): TConstructor0<U>;
/** Creates a `Promise<T>` type. */

@@ -429,0 +426,0 @@ static Promise<T extends TSchema>(item: T, options?: UserDefinedOptions): TPromise<T>;

@@ -30,2 +30,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Type = exports.modifierSymbol = void 0;
function reflect(value) {

@@ -32,0 +33,0 @@ switch (typeof value) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc