Error Handling in TypeScript: Passing Schema to Function

hello and trying to make a function builder shape of an schema that i can pass the schema by parameter like

import * as S from '@effect/schema/Schema'
import { BaseModel, ObjectId } from '@devx/core-domain'

export const getPaginatedResponse = <T>(schema: S.Schema<T>) =>
  S.Struct({
    data: S.Array(schema),
    cursor: S.String,
    hasMore: S.Boolean,
 })

export const UserId = S.String.pipe(S.fromBrand(ObjectId))
export type UserId = S.Schema.Type<typeof UserId>

export class User extends S.Class<User>('User')({
  ...BaseModel.fields,
  id: UserId,
  username: S.optional(S.String),
}) {
  static readonly _tag = 'User'
  static readonly pluralName = 'Users'
}

getPaginatedResponse(User)


but resulting in an error type when i try to passing the schema to the function, what i am doing wrong?
somebody can help me with this thanks in advance
Screenshot_2024-06-17_at_4.27.09_p.m..png
Was this page helpful?