Recursive type problem:
Hello,
I'm trying to define a recursive type with the library, but without success, i have the error remoteFieldSchema is unresolvable. What can i do:
const recTypes = type.module({
remoteFieldSchema: {
arguments: type({ "[string]": "string" }),
field: type({ "[string]": "remoteFieldSchema" }).optional(),
},
});
thanks in advance.2 Replies
Don't wrap your definitions in
type- that will try to parse them using the default scope
Just pass them directly to type.module and use "field?" to make the key optional
I meant to add a gotcha about this to the Scope docs, so this is a good reminder thank you 🙂
Here's the new warning:
Even if you reference it as part of your scope definition, the global type parser only knows about builtin keywords.
If you need access to fluent syntax from within a scope, see thunks.Thank you very much !