Static Hermes Typed Mode Compatibility - Investigation & Tracking #5912
schickling
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
This discussion tracks the compatibility between Effect and Static Hermes typed mode - Facebook's ahead-of-time compiler that can compile TypeScript to native binaries with C/C++-like performance.
TL;DR: Effect is currently incompatible with Static Hermes typed mode due to several JavaScript patterns that the typed compiler doesn't support. This discussion documents the specific blockers and potential paths forward.
What is Static Hermes Typed Mode?
Static Hermes offers two compilation modes:
shermes -typed): Uses TypeScript/Flow type annotations to generate truly optimized native code, eliminating dynamic dispatch and enabling aggressive inliningThe typed mode is the interesting one for performance-critical applications, as it promises "predictable performance on par with C/C++".
Current Status: ❌ Incompatible
When attempting to compile bundled Effect code with
shermes -typed, the compiler fails with 20+ errors before giving up.Blocking Issues
1. Computed Property Names in Classes
Error:
ft: computed property names in classes are unsupportedThis is fundamental to how Effect implements iterables and type branding throughout the codebase.
2. Private Class Fields
Error:
ft: unsupported class member ClassPrivateProperty3. Optional Chaining on Calls
Error:
ft: optional call expression not supported4. Dynamic Property Access
Error:
ft: unsupported5. Complex Type Inference Patterns
The typed compiler falls back to
anyfor many closure patterns and use ofarguments, losing type benefits:What Works: Untyped Mode ✅
Effect does work with Static Hermes untyped mode. All major features pass:
However, untyped mode is ~3x slower than Node.js for Effect operations, making it less attractive for performance-focused use cases.
Potential Paths Forward
Option 1: Wait for Static Hermes to Expand Support
Static Hermes is under active development. Relevant tracking issues:
Option 2: Effect Compilation Target
Create a build/compilation step that transforms Effect's patterns into typed-mode-compatible code:
[Symbol.iterator]()with explicit iterator implementationsThis would be complex and require maintaining a parallel "static-hermes-compatible" build.
Option 3: Effect-lite for Static Hermes
Create a minimal subset of Effect that avoids incompatible patterns, designed specifically for AOT compilation scenarios.
Option 4: Alternative AOT Compilers
Explore other TypeScript-to-native paths:
Experiment Details
Full experiment report with test code, benchmarks, and detailed error analysis:
https://gist.github.com/schickling/e53f0e65b772c0e62492c99afe3ae2cf
Environment
static_hbranch (December 2025)Reproduction
Questions for Discussion
This discussion was created based on experimental investigation. Please share any additional findings or alternative approaches!
Beta Was this translation helpful? Give feedback.
All reactions