You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! First of all, I want to thank you for open-sourcing this nice project!
I am trying to combine SandboxJS with typescript to evaluate typescript code. However, the evaluation undesirably fails when I use optional chaining operators like below (I'm not targeting ES2022 because SandboxJS does not support nullish coalescing operator (??) at the moment):
transpiled return myTest === null || myTest === void 0 ? void 0 : myTest.myMethod;
/Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:1929
throw new TypeError(`Cannot get property ${b} of null`);
^
TypeError: Cannot get property myMethod of null
at /Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:1929:15
at execSync (/Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2758:28)
at /Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2447:5
at execSync (/Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2758:28)
at /Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2739:36
at syncDone (/Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2615:5)
at execSync (/Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2739:20)
at /Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2739:36
at syncDone (/Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2615:5)
at execSync (/Users/qbx2/test/node_modules/.pnpm/@[email protected]/node_modules/@nyariv/sandboxjs/dist/node/Sandbox.js:2739:20)
Node.js v18.17.0
NOTE: After a small amount of digging, it seems that there is a priority issue because the evaluation succeeds when I add parentheses around the condition like return (myTest === null || myTest === void 0) ? void 0 : myTest.myMethod.
The text was updated successfully, but these errors were encountered:
Hello! First of all, I want to thank you for open-sourcing this nice project!
I am trying to combine SandboxJS with typescript to evaluate typescript code. However, the evaluation undesirably fails when I use optional chaining operators like below (I'm not targeting ES2022 because SandboxJS does not support nullish coalescing operator (??) at the moment):
Result:
NOTE: After a small amount of digging, it seems that there is a priority issue because the evaluation succeeds when I add parentheses around the condition like
return (myTest === null || myTest === void 0) ? void 0 : myTest.myMethod
.The text was updated successfully, but these errors were encountered: