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: validate JS/TS functions are exported before optimization
For JavaScript and TypeScript, non-exported functions cannot be imported
by tests, making optimization impossible. Previously, codeflash would
generate tests that try to import non-exported functions, leading to
confusing runtime errors like "Expected function 'foo' but got undefined".
This change adds early validation when the user specifies a function to
optimize via --function flag. If the function is not exported, codeflash
now shows a clear error message explaining the issue and how to fix it.
Example error message:
> Function 'getEnvLogLevel' is not exported from src/utils/AppUtils.ts.
> In JavaScript/TypeScript, only exported functions can be optimized
> because tests need to import them.
> To fix: Add 'export' keyword to the function declaration, e.g.:
> export const getEnvLogLevel = ...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments