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
fix: hoist grantedMs/grantedMin declarations to avoid ReferenceError in ncc bundles (#545)
The `grantedMs` and `grantedMin` variables were declared with `const`
inside the `if (decision.extend && decision.minutes > 0)` block but
referenced in the `return` statement outside that block. While the
conditional spread `...(decision.extend ? { granted_ms: grantedMs } : {})`
logically only evaluates when `decision.extend` is true, bundlers like
ncc can hoist or restructure code in ways that cause a ReferenceError
at runtime because the block-scoped `const` is not visible outside the
`if` block.
Fix: declare both variables with `let` (initialized to 0) before the
`if` block so they are in scope for the return statement.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments