Repository: element-plus/element-plus
File: packages/components/tree-v2/src/composables/useCheck.ts (TypeScript)

Code before:
            checkedKeySet.delete(node.key)
            indeterminateKeySet.delete(node.key)
          }
        }
        node.isEffectivelyChecked = isEffectivelyChecked
      })
    }
    indeterminateKeys.value = indeterminateKeySet
  }

  const isChecked = (node: TreeNode) => checkedKeys.value.has(node.key)

  const isIndeterminate = (node: TreeNode) =>
    indeterminateKeys.value.has(node.key)

  const toggleCheckbox = (
    node: TreeNode,
    isChecked: CheckboxValueType,
    nodeClick = true,
    immediateUpdate = true
  ) => {
    const checkedKeySet = checkedKeys.value
    const children = node.children
    if (!props.checkStrictly && nodeClick && children?.length) {
      const allChecked = children.every((node) => node.isEffectivelyChecked)
      isChecked = !allChecked
    }

    const toggle = (node: TreeNode, checked: CheckboxValueType) => {
      checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](
        node.key
      )
      const children = node.children
      if (!props.checkStrictly && children) {
        children.forEach((childNode) => {
          if (!childNode.disabled || childNode.children) {
            toggle(childNode, checked)
          }
        })
      }
    }
    toggle(node, isChecked)
    if (immediateUpdate) {
      updateCheckedKeys()
    }
    if (nodeClick) {
      afterNodeCheck(node, isChecked)
    }
  }

  const afterNodeCheck = (node: TreeNode, checked: CheckboxValueType) => {

Review comment (suggestion):
```suggestion
      isChecked = children.some((node) => !node.isEffectivelyChecked)
```

Code after:
            checkedKeySet.delete(node.key)
            indeterminateKeySet.delete(node.key)
          }
        }
        node.isEffectivelyChecked = isEffectivelyChecked
      })
    }
    indeterminateKeys.value = indeterminateKeySet
  }

  const isChecked = (node: TreeNode) => checkedKeys.value.has(node.key)

  const isIndeterminate = (node: TreeNode) =>
    indeterminateKeys.value.has(node.key)

  const toggleCheckbox = (
    node: TreeNode,
    isChecked: CheckboxValueType,
    nodeClick = true,
    immediateUpdate = true
  ) => {
    const checkedKeySet = checkedKeys.value
    const children = node.children
    if (!props.checkStrictly && nodeClick && children?.length) {
      isChecked = children.some((node) => !node.isEffectivelyChecked)
    }

    const toggle = (node: TreeNode, checked: CheckboxValueType) => {
      checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](
        node.key
      )
      const children = node.children
      if (!props.checkStrictly && children) {
        children.forEach((childNode) => {
          if (!childNode.disabled || childNode.children) {
            toggle(childNode, checked)
          }
        })
      }
    }
    toggle(node, isChecked)
    if (immediateUpdate) {
      updateCheckedKeys()
    }
    if (nodeClick) {
      afterNodeCheck(node, isChecked)
    }
  }

  const afterNodeCheck = (node: TreeNode, checked: CheckboxValueType) => {
    const { checkedNodes, checkedKeys } = getChecked()