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

How to handle referencing Runtypes in other files? #79

Open
simenandre opened this issue May 13, 2021 · 1 comment
Open

How to handle referencing Runtypes in other files? #79

simenandre opened this issue May 13, 2021 · 1 comment
Labels
bug Something isn't working enhancement New feature or request

Comments

@simenandre
Copy link
Owner

Describe the bug

I'm trying to import Runtype objects from other files.

Field names are updated in our name formatter. Maybe we should consider adding a reference variable, so we don't have to fix this in our name formatter? 🤷‍♂️

re #53

To Reproduce

{
  "kind": "record",
  "fields": [
    {
      "name": "inv",
      "type": { "kind": "named", "name": "MyRunTypes.Invoice" }
    }
  ]
}
import * as MyRuntypes from "../my-runtypes";
export const ReferenceToInvoiceRt = rt.Record({
  inv: myruntypes.InvoiceRt,
});
@simenandre simenandre added bug Something isn't working enhancement New feature or request labels May 13, 2021
@runeh
Copy link
Collaborator

runeh commented May 16, 2021

What kind of reference variable do you mean?

Can this be solved with an option to add a string preamble when generating?

No strong opinion on this yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants