Skip to content

Commit

Permalink
chore: apply reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjuan committed Jan 15, 2024
1 parent f799a52 commit a84ed04
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/type-utils/src/isUnsafeAssignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@ export function isUnsafeAssignment(
receiver: ts.Type,
checker: ts.TypeChecker,
senderNode: TSESTree.Node | null,
visited = new Map<ts.Type, Set<ts.Type>>(),
): false | { sender: ts.Type; receiver: ts.Type } {
return isUnsafeAssignmentWorker(
type,
receiver,
checker,
senderNode,
new Map(),
);
}

function isUnsafeAssignmentWorker(
type: ts.Type,
receiver: ts.Type,
checker: ts.TypeChecker,
senderNode: TSESTree.Node | null,
visited: Map<ts.Type, Set<ts.Type>>,
): false | { sender: ts.Type; receiver: ts.Type } {
if (isTypeAnyType(type)) {
// Allow assignment of any ==> unknown.
Expand Down Expand Up @@ -84,7 +99,7 @@ export function isUnsafeAssignment(
const arg = typeArguments[i];
const receiverArg = receiverTypeArguments[i];

const unsafe = isUnsafeAssignment(
const unsafe = isUnsafeAssignmentWorker(
arg,
receiverArg,
checker,
Expand Down

0 comments on commit a84ed04

Please sign in to comment.