Stream: jco

Topic: Generated code triggers ILLEGAL_REASSIGNMENT due to const re


view this post on Zulip ktz_alias (Mar 17 2026 at 03:20):

Hi all,

After upgrading to Vite 8, we're seeing the following build-time error:

[ILLEGAL_REASSIGNMENT] Error: Unexpected re-assignment of const variable storagePtr

It appears in JS code generated by jco, for example:

function _liftFlatRecord(keysAndLiftFns) {
  return function _liftFlatRecordInner(ctx) {
    _debugLog('[_liftFlatRecord()] args', { ctx });
    const { memory, useDirectParams, storagePtr, storageLen, params } = ctx;

    if (useDirectParams) {
      storagePtr = params[0]; // <-- re-assignment causes ILLEGAL_REASSIGNMENT
    }

Dev mode works fine, but production build fails. Has anyone encountered this before, or have suggestions for handling const reassignment in generated code?

view this post on Zulip ktz_alias (Mar 17 2026 at 03:20):

As a workaround, changing the destructured binding from const to let avoids the error.

view this post on Zulip ktz_alias (Mar 17 2026 at 03:21):

jco 1.16.1 also generates the same code, but vite 7.3.1 does not report an error.
The issue becomes visible when using jco 1.17.0.

view this post on Zulip Victor Adossi (Mar 17 2026 at 11:41):

Thanks for the report @ktz_alias ! Will have a bug fix release out soon

view this post on Zulip Victor Adossi (Mar 17 2026 at 15:36):

OK new version of Jco is out -- 1.17.1, please let me know if you still run into this -- should be fixed

view this post on Zulip Victor Adossi (Mar 18 2026 at 10:01):

@ktz_alias would you mind re-checking this one too? I think you should be good now


Last updated: Mar 23 2026 at 16:19 UTC