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
Handle recursive types? #13
Comments
I think it'd be best to allow the schema parameter to be a callback to the actual types. As in..
|
Unfortunately I am no longer able to maintain this project, I apologize. If someone wishes to step up and take leadership of this project please respond to #21 |
I agree this should be doable (although I'm not sure what change are needed), but my workaround is to create a custom Typed.Component = Typed('Component', value =>
value instanceof Component ? value
: TypeError(`"${value}" is not a Component`))
export default class Component extends Record({
name: String,
components: List(Typed.Component),
properties: List(Property)
}) {
// ...
} |
Is there any way to handle recursive types? I.e.
One can't do the above, as Node is not defined yet, when defining subNodes. Is there a way to accomplish this now, or do you have plans for this capability?
One possibility would be to add a constant, say "CurrentType", that would tell Record to use it's type for that member when creating new records. I.e.:
Thoughts?
The text was updated successfully, but these errors were encountered: