Passing Schema as a Parameter for Local and Remote File Handling

Is it recommended to pass schema as a parameter?

I am wanting to do this to push through a local file loader and remote file loader to have an update local file function however I have not been able to figure out how to do this with a generic extending Schema.Struct. Also, I am wanting to take the RemoteSchema and wrapping it with the etag from remote file.

const SchemaStruct = Schema.Struct({})
export const updateData = <A extends typeof SchemaStruct>(
  localPath: string,
  remotePath: string,
  RemoteSchema: A,
) =>
  Effect.gen(function* () {
    const localFile = yield* LocalFile;
    const remoteHead = yield* RemoteHeadUnkeyed;
    const remoteFile = yield* RemoteFileUnkeyed;
    const saveFile = yield* SaveFile;

    const LocalSchema = Schema.Struct({
      data: Schema.Struct(RemoteSchema.fields),
      etag: Schema.String,
    });
Was this page helpful?