InferType<T>: T extends SchemaBuilder<infer TResult, infer TRequired> ? T extends { optimize: ((...args) => SchemaBuilder<infer TOptimizedType, infer TOptimizedRequired>); } ? TOptimizedRequired extends true ? TOptimizedType : MakeOptional<TOptimizedType> : TRequired extends true ? TResult : MakeOptional<TResult> : T