♻️ Use line comments in primitive matchers
Replace the three `/* */` prose blocks with `//` line comments, matching the rest of the codebase and the comment style the oxlint config now allows.
This commit is contained in:
1 parent
fa0b7f2e84
commit
068d6b4998
1 file changed
+10
-16
+10
-16
@@ -19,10 +19,8 @@ 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
|
||||||
Rewrite not to use any is possible, was evaluated and solutions were
|
// more complex than the current solution.
|
||||||
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);
|
||||||
@@ -50,10 +48,8 @@ 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
|
||||||
Rewrite not to use any is possible, was evaluated and solutions were
|
// more complex than the current solution.
|
||||||
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);
|
||||||
@@ -65,13 +61,11 @@ export const getPrimitiveUnionMatcherPartial: <T extends string | number>() => <
|
|||||||
export const getPrimitiveUnionMatcherPartialW: <
|
export const getPrimitiveUnionMatcherPartialW: <
|
||||||
T extends string | number,
|
T extends string | number,
|
||||||
>() => <P extends PatternPrimitiveUnionPartial<unknown, T>>(
|
>() => <P extends PatternPrimitiveUnionPartial<unknown, T>>(
|
||||||
/*
|
// `Simplify<P>` is the inference hook: callers infer `P` from the argument.
|
||||||
`Simplify<P>` is the inference hook: callers infer `P` from the argument.
|
// the second half pins the impl parameter's `R` to `PatternReturns<P>`.
|
||||||
the second half pins the impl parameter's `R` to `PatternReturns<P>`.
|
// that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check.
|
||||||
that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check.
|
// neither half works alone.
|
||||||
neither half works alone.
|
// without the witness the union's `_` arm demands `_ ∈ keyof P`.
|
||||||
without the witness the union's `_` arm demands `_ ∈ keyof P`.
|
// without `Simplify<P>` the parameter types do not compare.
|
||||||
without `Simplify<P>` the parameter types do not compare.
|
|
||||||
*/
|
|
||||||
pattern: Simplify<P> & PatternPrimitiveUnionPartial<PatternReturns<P>, T>,
|
pattern: Simplify<P> & PatternPrimitiveUnionPartial<PatternReturns<P>, T>,
|
||||||
) => UnaryFn<T, PatternReturns<P>> = getPrimitiveUnionMatcherPartial;
|
) => UnaryFn<T, PatternReturns<P>> = getPrimitiveUnionMatcherPartial;
|
||||||
Reference in new issue
Block a user