How to upgrade typescript for cocos creator for xstate v5

Hi guys
anyone has solution for this? I am try to use xstate v5 (Stately + XState docs | Stately) with Cocos creator, but Xstate requires typescript v5 to work.

below this the error with cocos 3.8.3
cr.mjs:15 Found possible circular reference in “http://localhost:7456/scripting/x/chunks/4c/4cf0f50d0e08cff0547c3052743e8770c0d30c15.js”, happened when use “createMachine” imported from “xstate” Error
at Object.execute (toggleMachine.ts:3:23)
at doExec (system-core.js:309:30)
at postOrderExec (system-core.js:300:21)
at system-core.js:285:28
at Array.forEach ()
at postOrderExec (system-core.js:283:10)
at system-core.js:232:12