You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
ISSUE:
I was facing a lint error: Type instantiation is excessively deep and possibly infinite
combineConditionsBranch<TArgs, TQuery, TBuilder extends QueryBuilder<TArgs, TQuery>>(
combination: ArgsCombination<TArgs>,
inputBuilder: TBuilder,
): TBuilder {
let updatedBuilder = match(combination)
.with({ operation: "AND" }, { operation: undefined }, () => inputBuilder.and())
.with({ operation: "OR", matches: __ }, () => inputBuilder.or())
.with({ operation: "NOT", matches: when((ms: string | any[]) => ms.length === 1) }, () => inputBuilder.not())
.exhaustive();
for (const argMatchOrCombination of combination.matches) {
if (isArgMatch(argMatchOrCombination)) {
/* eslint-disable @typescript-eslint/no-loop-func */
updatedBuilder = match(argMatchOrCombination)
.with({ operator: "EQ" }, am => updatedBuilder.equals(am))
.with({ operator: "NE" }, am => updatedBuilder.notEquals(am))
.with({ operator: "LT" }, am => updatedBuilder.less(am))
.with({ operator: "LE" }, am => updatedBuilder.lessEquals(am))
.with({ operator: "GT" }, am => updatedBuilder.greater(am))
.with({ operator: "GE" }, am => updatedBuilder.greaterEquals(am))
.with({ operator: "IN" }, am => updatedBuilder.in(am))
.with({ argName: __.string }, am => updatedBuilder.equals(am as ArgMatch<TArgs>))
.otherwise(() => {
throw new Error(`Cannot evaluate the argument match: ${JSON.stringify(argMatchOrCombination)}`);
}) as unknown as Union<Union<Union<never, TBuilder>, TBuilder>, TBuilder>;
/* eslint-enable @typescript-eslint/no-loop-func */
} else {
updatedBuilder = combineConditionsBranch(argMatchOrCombination, updatedBuilder);
}
}
return updatedBuilder;
}
Currently using : "typescript": "5.0.4", "ts-pattern": "5.1.2",
Earlier packages : "typescript": "5.1.3", "ts-pattern": "3.3.3",
due to TS Error found a suggestion to use 5.0.4 and also included skipLibCheck:true in the tsconfig.
However, it still remains and more over after I tried upgrading ts-pattern from v3 to v5 I've started getting : Cannot find module 'ts-pattern' or its corresponding type declarations.
EXPECTED:
No TS Error
Since its work related I can't share any more code. Any package info if required let me know.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
ISSUE:
I was facing a lint error: Type instantiation is excessively deep and possibly infinite
Currently using :
"typescript": "5.0.4", "ts-pattern": "5.1.2",
Earlier packages :
"typescript": "5.1.3", "ts-pattern": "3.3.3",
due to TS Error found a suggestion to use 5.0.4 and also included
skipLibCheck:true
in the tsconfig.However, it still remains and more over after I tried upgrading ts-pattern from v3 to v5 I've started getting : Cannot find module 'ts-pattern' or its corresponding type declarations.
EXPECTED:
No TS Error
Since its work related I can't share any more code. Any package info if required let me know.
Beta Was this translation helpful? Give feedback.
All reactions