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

From Discord: Runtime Error When Extending Object with Optional Keys in TypeScript #3124

Closed
effect-bot opened this issue Jun 29, 2024 · 0 comments · Fixed by #3125 or #3126
Closed
Assignees
Labels
bug Something isn't working schema

Comments

@effect-bot
Copy link

Summary

Summary

The user is encountering a runtime error when attempting to extend an object with optional keys using TypeScript and the @effect/schema library. The provided code snippet defines a schema Foo with an optional foo property that has a default value. The schema is then extended with a union of two structures, each containing optional properties bar and baz. This results in a runtime error indicating unsupported schema or overlapping types.

Key Takeaways

  1. Code Context:

    • The user is defining a schema Foo with an optional property foo.
    • The schema is extended with a union of two structures, each containing optional properties bar and baz.
  2. Error Details:

    • The error message indicates that extending the schema with the given union results in unsupported schema or overlapping types.
    • The specific error occurs at node_modules/@effect/schema/dist/esm/Schema.js:1362:9.
  3. Possible Bug:

    • The user suspects that this might be a bug in the @effect/schema library.
  4. Technical Insight:

    • The error suggests that the library might have limitations or issues when handling extensions involving optional keys and unions.

Conclusion

The user is facing a runtime error when extending a schema with optional keys using the @effect/schema library. The error message points to unsupported schema or overlapping types, and the user suspects this might be a bug in the library.

Discord thread

https://discord.com/channels/795981131316985866/1256309278432563243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working schema
Projects
None yet
2 participants