import AnyContext from './types/any' ; import ArrayContext from './types/array' ; import BooleanContext from './types/boolean' ; import NumberContext from './types/number' ; import ObjectContext , { Props } from './types/object' ; import StringContext from './types/string' ; import EitherContext from './types/either' ; import LiteralContext from './types/literal' ; import Context from './ctx' ; import { TypeOf } from './types' ; type TypeContext = { makeOptional : ( ) => Context ; makeNullable : ( ) => Context ; makeOptionalNullable : ( ) => Context ; } ; const optionalNullable = { get any ( ) { return new AnyContext ( ) . makeOptionalNullable ( ) ; } , arr < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) . makeOptionalNullable ( ) as any ; } , array < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) . makeOptionalNullable ( ) as any ; } , get bool ( ) { return new BooleanContext ( ) . makeOptionalNullable ( ) ; } , get boolean ( ) { return new BooleanContext ( ) . makeOptionalNullable ( ) ; } , get num ( ) { return new NumberContext ( ) . makeOptionalNullable ( ) ; } , get number ( ) { return new NumberContext ( ) . makeOptionalNullable ( ) ; } , obj < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) . makeOptionalNullable ( ) as any ; } , object < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) . makeOptionalNullable ( ) as any ; } , either < CtxA extends Context , CtxB extends Context > ( ctxA , ctxB ) { return new EitherContext ( ctxA , ctxB ) . makeOptionalNullable ( ) as any ; } , get str ( ) { return new StringContext ( ) . makeOptionalNullable ( ) ; } , get string ( ) { return new StringContext ( ) . makeOptionalNullable ( ) ; } , type < T extends Context & TypeContext > ( Ctx ) { return new Ctx ( ) . makeOptionalNullable ( ) as any ; } , use < T extends Context = Context > ( ctx ) { return new AnyContext < TypeOf < T > > ( ) . makeOptionalNullable ( ) . pipe ( ctx . test ) ; } , literal < T > ( literal ) { return new LiteralContext ( literal ) . makeOptionalNullable ( ) ; } , } ; const $ = { get any ( ) { return new AnyContext ( ) ; } , arr < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) ; } , array < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) ; } , get bool ( ) { return new BooleanContext ( ) ; } , get boolean ( ) { return new BooleanContext ( ) ; } , get num ( ) { return new NumberContext ( ) ; } , get number ( ) { return new NumberContext ( ) ; } , obj < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) ; } , object < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) ; } , either < CtxA extends Context , CtxB extends Context > ( ctxA , ctxB ) { return new EitherContext ( ctxA , ctxB ) ; } , get str ( ) { return new StringContext ( ) ; } , get string ( ) { return new StringContext ( ) ; } , type < T > ( Ctx ) { return new Ctx ( ) ; } , use < T extends Context = Context > ( ctx ) { return new AnyContext < TypeOf < T > > ( ) . pipe ( ctx . test ) ; } , literal < T extends keyof any > ( literal ) { return new LiteralContext ( literal ) ; } , /**
     * undefined を許容します
     */ optional : { get any ( ) { return new AnyContext ( ) . makeOptional ( ) ; } , arr < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) . makeOptional ( ) as any ; } , array < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) . makeOptional ( ) as any ; } , get bool ( ) { return new BooleanContext ( ) . makeOptional ( ) ; } , get boolean ( ) { return new BooleanContext ( ) . makeOptional ( ) ; } , get num ( ) { return new NumberContext ( ) . makeOptional ( ) ; } , get number ( ) { return new NumberContext ( ) . makeOptional ( ) ; } , obj < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) . makeOptional ( ) as any ; } , object < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) . makeOptional ( ) as any ; } , either < CtxA extends Context , CtxB extends Context > ( ctxA , ctxB ) { return new EitherContext ( ctxA , ctxB ) . makeOptional ( ) as any ; } , get str ( ) { return new StringContext ( ) . makeOptional ( ) ; } , get string ( ) { return new StringContext ( ) . makeOptional ( ) ; } , type < T extends Context & TypeContext > ( Ctx ) { return new Ctx ( ) . makeOptional ( ) as any ; } , use < T extends Context = Context > ( ctx ) { return new AnyContext < TypeOf < T > > ( ) . makeOptional ( ) . pipe ( ctx . test ) ; } , literal < T extends keyof any > ( literal ) { return new LiteralContext ( literal ) . makeOptional ( ) ; } , /**
         * undefined と null を許容します
         */ nullable : optionalNullable } , /**
     * null を許容します
     */ nullable : { get any ( ) { return new AnyContext ( ) . makeNullable ( ) ; } , arr < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) . makeNullable ( ) as any ; } , array < T extends Context = Context > ( ctx ? ) { return new ArrayContext ( ctx ) . makeNullable ( ) as any ; } , get bool ( ) { return new BooleanContext ( ) . makeNullable ( ) ; } , get boolean ( ) { return new BooleanContext ( ) . makeNullable ( ) ; } , get num ( ) { return new NumberContext ( ) . makeNullable ( ) ; } , get number ( ) { return new NumberContext ( ) . makeNullable ( ) ; } , obj < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) . makeNullable ( ) as any ; } , object < T extends Props > ( ctx ? ) { return new ObjectContext ( ctx ) . makeNullable ( ) as any ; } , either < CtxA extends Context , CtxB extends Context > ( ctxA , ctxB ) { return new EitherContext ( ctxA , ctxB ) . makeNullable ( ) as any ; } , get str ( ) { return new StringContext ( ) . makeNullable ( ) ; } , get string ( ) { return new StringContext ( ) . makeNullable ( ) ; } , type < T extends Context & TypeContext > ( Ctx ) { return new Ctx ( ) . makeNullable ( ) as any ; } , use < T extends Context = Context > ( ctx ) { return new AnyContext < TypeOf < T > > ( ) . makeNullable ( ) . pipe ( ctx . test ) ; } , literal < T extends keyof any > ( literal ) { return new LiteralContext ( literal ) . makeNullable ( ) ; } , /**
         * undefined と null を許容します
         */ optional : optionalNullable } , /**
     * undefined と null を許容します
     */ optionalNullable : optionalNullable } ; export default $ ; export { Context , AnyContext , ArrayContext , BooleanContext , NumberContext , ObjectContext , StringContext , EitherContext } ;