Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use ArkType with Expo #1027

Closed
eduardo-gualberto opened this issue Jun 24, 2024 · 3 comments
Closed

Unable to use ArkType with Expo #1027

eduardo-gualberto opened this issue Jun 24, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@eduardo-gualberto
Copy link

Report a bug

🔎 Search Terms

@babel/plugin-transform-class-static-block
expo

🧩 Context

  • ArkType version: 2.0.0-dev.25
  • TypeScript version (5.1+): 5.5.2
  • Other context you think may be relevant (JS flavor, OS, etc.): MacOS, Apple Silicon, React Native, Expo

🧑‍💻 Repro

I'll leave a repository containing a minimal reproduction code: https://github.com/eduardo-gualberto/arktype-repro-01

import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
import { type } from "arktype";

export default function App() {
  const myType = type({
    test: "string",
    test2: "number>5",
  });
  return (
    <View style={styles.container}>
      <Text>Open up App.tsx to start working on your app!</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});

I noticed I could not make arktype work with a create-expo-app (typescript templated) project.

It first complains about a missing babel plugin called plugin-transform-class-static-block. Such as bellow.

Screenshot 2024-06-24 at 16 23 07

Then, after installing the plugin and adding it to babel.config, the error changes to

Screenshot 2024-06-24 at 16 26 41
@eduardo-gualberto eduardo-gualberto added the bug Something isn't working label Jun 24, 2024
@ssalbdivad
Copy link
Member

ssalbdivad commented Jun 24, 2024

Thanks for logging this! It looks like a bug with the way Expo/babel are parsing the TypeScript output for decorators.

I have my tsconfig target set to ES2022, so as long as the parser supports at least that, it should work out of the box.

I'm not sure about intersection.equals being undefined in hermes, but given that it works in every other runtime I've tested, it also seems worth opening an issue with the maintainers of that project to see if they have an idea what's going on.

I'm happy to try and accommodate this environment if there are specific, targeted changes I can make to do so.

@eduardo-gualberto
Copy link
Author

Thank you for replying so quickly!

It seems there are quite a few problems just like that with the hermes interpreter, not my lucky day.

The crazy thing is that using version 2.0.0-dev.0 of ArkType the problem seems to go away.

@ssalbdivad
Copy link
Member

I can't say for sure what was in the newer releases that wasn't in that one, but I can say I can't maintain a limited feature set based on what Hermes supports going forward.

If there's a specific problem I can easily address please do let me know as I'd love to help. I'll close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done (merged or closed)
Development

No branches or pull requests

2 participants