Error with Unsupported Match Pattern in TypeScript
Is this a supported match pattern?
IT complains with the following:
Here is a repro: https://effect.website/play#2a5c74487cf6
const matcher = Match.type<{ start: AB | null; end: AB | null }>().pipe(
Match.when({ start: null, end: null }, () => Effect.fail("")),
Match.when(
{ start: Match.instanceOf(A), end: Match.instanceOf(A) }, // error here
({ start, end }) => Effect.succeed(['as',start, end] as const)
),
Match.when(
{ start: Match.instanceOf(B), end: Match.instanceOf(B) }, // error here
({ start, end }) => Effect.succeed(['bs', start, end] as const)
),
Match.orElse(() => Effect.fail("Unsupported case"))
)const matcher = Match.type<{ start: AB | null; end: AB | null }>().pipe(
Match.when({ start: null, end: null }, () => Effect.fail("")),
Match.when(
{ start: Match.instanceOf(A), end: Match.instanceOf(A) }, // error here
({ start, end }) => Effect.succeed(['as',start, end] as const)
),
Match.when(
{ start: Match.instanceOf(B), end: Match.instanceOf(B) }, // error here
({ start, end }) => Effect.succeed(['bs', start, end] as const)
),
Match.orElse(() => Effect.fail("Unsupported case"))
)IT complains with the following:
src/main.ts(13,7): error TS2353: Object literal may only specify known properties, and 'start' does not exist in type 'PatternPrimitive<never>'.src/main.ts(13,7): error TS2353: Object literal may only specify known properties, and 'start' does not exist in type 'PatternPrimitive<never>'.Here is a repro: https://effect.website/play#2a5c74487cf6
