What it changes
Rewrites optional chains as equivalent conditional expressions while preserving short-circuiting and method receivers.Before and after
Configuration
Run this transform by settingtransforms.optionalChainingToTernary to true:
obfuscate.mjs
View the implementation
Open the TypeScript implementation on GitHub.
Read the behavior tests
Review behavior checks and cases this transform leaves alone.