How to Ensure a Type Extends a Base Schema in TypeScript

I want to be able to do something like the following:

type BaseSchema = typeof BaseSchema;
  const BaseSchema = Schema.Struct({
    test: Schema.String,
  })

  const InputSchma = Schema.Union(BaseSchema, Schema.Struct({
    hello: Schema.String,
  }))

  const createRequestFactory = <InputSchema extends BaseSchema>({}: {
    inputSchema: InputSchema;
  }) => {
    // Ignore this part 
  }

  const test = createRequestFactory({
    inputSchema: CartAddInput,
  })


Is there a way for me to say that the "inputSchema" prop needs to extend the base schema within type-land? Thanks ahead of time 😄 !
Was this page helpful?