import * as S from "@effect/schema/Schema";
function doSomethingWithSchema<const Schema extends S.Schema<any> | undefined = undefined>(
schema: Schema,
) {}
// what I would like to do....
function constrainedDoSomethingWithSchema<const Schema extends S.Schema<{version: number; id: string;}> | undefined = undefined>(
schema: Schema,
) {}
// works
constrainedDoSomethingWithSchema(S.struct({version: S.number, id: S.string}))
// does not work, but I would expect it to work
constrainedDoSomethingWithSchema(S.struct({ version: S.number, id: S.string, name: S.string; }));
import * as S from "@effect/schema/Schema";
function doSomethingWithSchema<const Schema extends S.Schema<any> | undefined = undefined>(
schema: Schema,
) {}
// what I would like to do....
function constrainedDoSomethingWithSchema<const Schema extends S.Schema<{version: number; id: string;}> | undefined = undefined>(
schema: Schema,
) {}
// works
constrainedDoSomethingWithSchema(S.struct({version: S.number, id: S.string}))
// does not work, but I would expect it to work
constrainedDoSomethingWithSchema(S.struct({ version: S.number, id: S.string, name: S.string; }));