Skip to content

effect@4-beta — Schema decode completely broken when transformed by babel-preset-expo (Jest) #6578

Description

@DCKT

What version of Effect is running?

4.0.0-beta.101

What steps can reproduce the bug?

Every Schema.decode* and Schema.encode* function throws at runtime when the effect package is transformed through babel-preset-expo in Jest. Schema creation and core Effect operations work fine — only the decode/encode pipeline is affected.
This blocks all React Native / Expo projects from upgrading to v4, since jest-expo requires effect in transformIgnorePatterns (effect is ESM-only).

Versions

  • effect: 4.0.0-beta.101
  • babel-preset-expo: ~57.0.0
  • jest: 29.7.0
  • Node: 22

Reproduction

Minimal repo: https://github.com/DCKT/effect-v4-babel-bug

git clone https://github.com/DCKT/effect-v4-babel-bug.git
cd effect-v4-babel-bug
yarn install --ignore-engines
yarn test

Config is minimal — the jest config just has transformIgnorePatterns: ["node_modules/(?!effect/)"] and the babel.config.js only uses babel-preset-expo.

What is the expected behavior?

All tests should pass with correct decoding

What do you see instead?

Current behavior (9 tests: 3 pass, 6 fail)

Test Error
decodeUnknownSync(String) Cannot read properties of undefined (reading '_tag') at SchemaParser.ts:922
decodeUnknownSync(Struct) Cannot read properties of undefined (reading 'reasons') at Schema.ts:1413
decodeUnknownSync(decodeTo) Cannot read properties of undefined (reading '_tag') at Option.ts:85
decodeUnknownExit(String) Cannot read properties of undefined (reading '_tag') at SchemaParser.ts:922
decodeUnknownExit(Struct) Cannot read properties of undefined (reading 'reasons') at internal/effect.ts:269
encodeUnknownSync(Struct) Cannot read properties of undefined (reading 'reasons') at Schema.ts:1413
All 3 passing tests are non-decode operations: Schema.String / Schema.Struct creation and Option.some/none.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions