Skip to content

How to handle referencing Runtypes in other files? #79

Description

@simenandre

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,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions