tenho seguinte código java e react

java

import { appDir, join } from "@tauri-apps/api/path";
import { readTextFile, createDir, writeBinaryFile, removeFile } from "@tauri-apps/api/fs";

// Configuração
const BASE_URL = "https://hil-speed.hetzner.com/";

// Estado global para progresso
export const downloadProgress = {
  message: "",
  current_file: 0,
  total_files: 0,
  file_name: "",
  downloaded_bytes: 0,
  total_bytes: 0,
};

// Função para ler o arquivo JSON path.json
export async function readPathJson() {
  try {
    const appPath = await appDir();
    const filePath = await join(appPath, "path.json");
    const fileContent = await readTextFile(filePath);
    return JSON.parse(fileContent);
  } catch (error) {
    console.error("Erro ao ler o arquivo path.json:", error);
    throw error;
  }
}

export async function downloadFiles() {
  const patchesDir = await join(await appDir(), "patches");

  await createDir(patchesDir, { recursive: true }).catch(() => {});

  const files = await readPathJson();
  downloadProgress.total_files = files.length;

  for (let i = 0; i < files.length; i++) {
    const file = files[i];
    const fileUrl = `${BASE_URL}${file.file_name}`;
    const filePath = await join(patchesDir, file.file_name);

    downloadProgress.current_file = i + 1;
    downloadProgress.file_name = file.file_name;

    await downloadFile(fileUrl, filePath, i + 1, files.length);
  }
}

async function downloadFile(url, filePath, currentFile, totalFiles) {
  while (true) {
    try {
      downloadProgress.downloaded_bytes = 0;
      downloadProgress.total_bytes = 0;
      downloadProgress.message = "Conectando ao servidor...";

      const response = await fetch(url);
      if (!response.ok) {
        throw new Error(`Erro ao conectar: ${response.statusText}`);
      }

      downloadProgress.total_bytes = parseInt(response.headers.get("Content-Length"), 10);
    
      downloadProgress.message = `Baixando arquivo ${currentFile} / ${totalFiles}`;
      const reader = response.body.getReader();
      let chunk;

      await removeFile(filePath).catch(() => {
        /* Ignorar erro se o arquivo não existir */
      });

      while (!(chunk = await reader.read()).done) {
        downloadProgress.downloaded_bytes += chunk.value.length;
        await writeBinaryFile(filePath, chunk.value, { append: true });

        console.log(
          `Baixando arquivo ${currentFile} / ${totalFiles}: ${downloadProgress.file_name} (${downloadProgress.downloaded_bytes} / ${downloadProgress.total_bytes})`
        );
      }

      downloadProgress.message = `Download concluído: ${downloadProgress.file_name}`;
      console.log(downloadProgress.message);
      break; // Download finalizado, sair do loop
    } catch (error) {
      console.error(`Erro no download: ${error.message}`);
      downloadProgress.message = `Erro ao conectar. Tentando novamente em 5 segundos...`;
      await new Promise((resolve) => setTimeout(resolve, 5000));
    }
  }
}

react

import { useState, useEffect } from "react";
import { downloadFiles, downloadProgress } from "../scripts/download"; // Importe suas funções

const DownloadStart = () => {
  const [currentFile, setCurrentFile] = useState(0);
  const [totalFiles, setTotalFiles] = useState(0);
  const [fileName, setFileName] = useState("");
  const [downloadedBytes, setDownloadedBytes] = useState(0);
  const [totalBytes, setTotalBytes] = useState(0);
  const [progressPercent, setProgressPercent] = useState(0);
  const [message, setMessage] = useState("");

  useEffect(() => {
    // Sincronizar com downloadProgress
    const interval = setInterval(() => {
      setCurrentFile(downloadProgress.current_file);
      setTotalFiles(downloadProgress.total_files);
      setFileName(downloadProgress.file_name);
      setDownloadedBytes(downloadProgress.downloaded_bytes);
      setTotalBytes(downloadProgress.total_bytes);
      setProgressPercent(((downloadProgress.downloaded_bytes / (downloadProgress.total_bytes)) * 100).toFixed(2));
      setMessage(downloadProgress.message);
    }, 500); // Atualize a cada 500ms

    return () => clearInterval(interval); // Limpe o intervalo quando o componente desmontar
  }, []);

  // Iniciar o download ao carregar o componente
  useEffect(() => {
    downloadFiles().catch((err) => console.error("Erro ao iniciar download:", err));
  }, []);

  return (
    <div className="absolute bottom-3 rounded-lg w-[71%] h-[8%] flex flex-col justify-between items-center">
      <p className="text-[14px] font-bold text-opacity-[0.95] text-white text-center">
        {message} ({currentFile} / {totalFiles}): {fileName} ({downloadedBytes} / {totalBytes} bytes)
      </p>
      <div className="w-[95%] bg-[#0E1622]/[0.95] rounded-md h-5 flex items-center">
        <div
          className="bg-[#1164CA]/[0.95] ml-1 rounded-md h-4 transition-all duration-300"
          style={{ width: `${progressPercent}%` }}
        />
      </div>
    </div>
  );
};

export default DownloadStart;


recebo erro 

[{
	"resource": "/C:/Users/jonatas/Desktop/Megasantos/_RagnaTalesReact/src/app/DownloadFile.tsx",
	"owner": "typescript",
	"code": "2345",
	"severity": 8,
	"message": "Argument of type 'string' is not assignable to parameter of type 'SetStateAction<number>'.",
	"source": "ts",
	"startLineNumber": 21,
	"startColumn": 26,
	"endLineNumber": 21,
	"endColumn": 113
}]