Skip to content

Commit

Permalink
fix: address deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Mar 22, 2024
1 parent b8d120d commit e1024e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/rules/no-untyped-mock-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ export default createRule({
create(context) {
return {
CallExpression(node: TSESTree.CallExpression): void {
const { callee, typeParameters } = node;
let { callee, typeArguments } = node;

/* istanbul ignore next */
if (!('typeArguments' in node)) {
typeArguments = (node as TSESTree.CallExpression).typeParameters;
}

if (callee.type !== AST_NODE_TYPES.MemberExpression) {
return;
Expand All @@ -53,7 +58,7 @@ export default createRule({
const [nameNode, factoryNode] = node.arguments;

const hasTypeParameter =
typeParameters !== undefined && typeParameters.params.length > 0;
typeArguments !== undefined && typeArguments.params.length > 0;
const hasReturnType =
isFunction(factoryNode) && factoryNode.returnType !== undefined;

Expand Down

0 comments on commit e1024e7

Please sign in to comment.