diff --git a/src/primitive.ts b/src/primitive.ts index 6759784..5046949 100644 --- a/src/primitive.ts +++ b/src/primitive.ts @@ -19,10 +19,8 @@ export const getPrimitiveUnionMatcherW: () => < >( pattern: Simplify

, ) => UnaryFn> = () => (pattern) => (shape) => - /* - Rewrite not to use any is possible, was evaluated and solutions were - more complex than the current solution. - */ + // Rewrite not to use any is possible, was evaluated and solutions were + // more complex than the current solution. // oxlint-disable-next-line typescript/no-explicit-any typescript/no-unsafe-type-assertion (pattern[shape] as any)(shape); @@ -50,10 +48,8 @@ export const getPrimitiveUnionMatcherPartial: () => < >( pattern: Simplify>, ) => UnaryFn = () => (pattern) => (shape) => - /* - Rewrite not to use any is possible, was evaluated and solutions were - more complex than the current solution. - */ + // Rewrite not to use any is possible, was evaluated and solutions were + // more complex than the current solution. // oxlint-disable-next-line typescript/no-explicit-any typescript/no-unsafe-type-assertion (pattern[shape] ?? (pattern as any)["_"])(shape); @@ -65,13 +61,11 @@ export const getPrimitiveUnionMatcherPartial: () => < export const getPrimitiveUnionMatcherPartialW: < T extends string | number, >() =>

>( - /* - `Simplify

` is the inference hook: callers infer `P` from the argument. - the second half pins the impl parameter's `R` to `PatternReturns

`. - that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check. - neither half works alone. - without the witness the union's `_` arm demands `_ ∈ keyof P`. - without `Simplify

` the parameter types do not compare. - */ + // `Simplify

` is the inference hook: callers infer `P` from the argument. + // the second half pins the impl parameter's `R` to `PatternReturns

`. + // that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check. + // neither half works alone. + // without the witness the union's `_` arm demands `_ ∈ keyof P`. + // without `Simplify

` the parameter types do not compare. pattern: Simplify

& PatternPrimitiveUnionPartial, T>, ) => UnaryFn> = getPrimitiveUnionMatcherPartial;