📝 Document why any is retained in primitive matchers

Rewriting without any was evaluated; the alternatives were more
complex than the current solution. Record the rationale next to the
two oxlint-disable sites so the suppression is not re-litigated.
This commit is contained in:
tmu committed 2026-09-16 21:39:46 +00:00
1 parent 8e2691e6aa
commit c13bc2f408
1 file changed
+10
+10
View File
@@ -19,6 +19,11 @@ export const getPrimitiveUnionMatcherW: <T extends string | number>() => <
>( >(
pattern: Simplify<P>, pattern: Simplify<P>,
) => UnaryFn<T, PatternReturns<P>> = () => (pattern) => (shape) => ) => UnaryFn<T, PatternReturns<P>> = () => (pattern) => (shape) =>
/*
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 // oxlint-disable-next-line typescript/no-explicit-any typescript/no-unsafe-type-assertion
(pattern[shape] as any)(shape); (pattern[shape] as any)(shape);
@@ -45,6 +50,11 @@ export const getPrimitiveUnionMatcherPartial: <T extends string | number>() => <
>( >(
pattern: Simplify<PatternPrimitiveUnionPartial<R, T>>, pattern: Simplify<PatternPrimitiveUnionPartial<R, T>>,
) => UnaryFn<T, R> = () => (pattern) => (shape) => ) => UnaryFn<T, R> = () => (pattern) => (shape) =>
/*
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 // oxlint-disable-next-line typescript/no-explicit-any typescript/no-unsafe-type-assertion
(pattern[shape] ?? (pattern as any)["_"])(shape); (pattern[shape] ?? (pattern as any)["_"])(shape);