Skip to content

React Native / Expo: 'defineProperty' error persists in TypeBox 1.0.x #1502

@feunard

Description

@feunard

Hello,

It seems we still have an issue with TypeBox and Expo / Metro bundler.

  • Expo SDK 54 (React Native 0.81)
  • Metro bundler with Babel
  • TypeBox 1.0.71

Reproduction Steps

npx create-expo-app@latest my-app
cd my-app
npm install typebox

Add import in app/(tabs)/index.tsx:

import 'typebox'

Run:

npm run ios

Error

ERROR  [TypeError: Cannot read property 'defineProperty' of undefined]

Root Cause

In src/type/types/object.ts:

export var Object = _Object_

Metro + Babel transforms this in a way that shadows the global Object, breaking Object.defineProperty calls.

Potential Fix

Replace the line with:

export { _Object_ as Object }

Related Issues

Thanks for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions