📝 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:
1 parent
8e2691e6aa
commit
c13bc2f408
1 file changed
+10
@@ -19,6 +19,11 @@ export const getPrimitiveUnionMatcherW: <T extends string | number>() => <
|
||||
>(
|
||||
pattern: Simplify<P>,
|
||||
) => 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
|
||||
(pattern[shape] as any)(shape);
|
||||
|
||||
@@ -45,6 +50,11 @@ export const getPrimitiveUnionMatcherPartial: <T extends string | number>() => <
|
||||
>(
|
||||
pattern: Simplify<PatternPrimitiveUnionPartial<R, T>>,
|
||||
) => 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
|
||||
(pattern[shape] ?? (pattern as any)["_"])(shape);
|
||||
|
||||
|
||||
Reference in new issue
Block a user