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

[epic] Builder pattern for TypeScript objects and types #367

Open
rbalicki2 opened this issue Feb 4, 2025 · 0 comments
Open

[epic] Builder pattern for TypeScript objects and types #367

rbalicki2 opened this issue Feb 4, 2025 · 0 comments

Comments

@rbalicki2
Copy link
Collaborator

rbalicki2 commented Feb 4, 2025

Initial thoughts... I would imagine we have:

  • the underlying source of truth, a btreemap of fields or whatever
  • some way to iterate/fold the btreemap, ideally in a typesafe manner
    from this, we would do one of two things:
  • either generate a string using a nice API, e.g. enter_object("field_name"), write_field("__typename", "ConcreteNameOfType"), etc), or
  • (probably better) generate a TSObject type and do stuff like .enter_object("field_name") etc, and then have that TSObject know how to stringify itself in a way that works for all of our generated files

I guess ideally, the TSObject is the entire pre-stringified artifact

Maybe one of these will work for us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant