the global value not change in typescript/javascript [closed]

i tried to test my function to change the value if the conditions true, but i really don’t know why i cant change it?

let logValue: unknown

type callableLoggerType = (side: string, args: unknown) => void | Error

const makeLoggerCallable: callableLoggerType = (side: string, args: unknown): void | Error => {
  const errMessage = `there's an Error happend.`
  if ((side === null || side === undefined) && (args === null || args === undefined)) return (logValue = new Error(errMessage))

console.log(logValue) // undefined ? it should be an Error ?

i tried everything, and i really don’t know how and what the problem