Can a type's field reference the Type type?

#1

For example,

type MyType {
    anotherType: Type
}
0 Likes

#2

Yes, but keep in mind that the Type type is not Persistable, so depending on your use case that might not work for you.

There is also a TypeRef type (which is not Persistable either), but it does provide some helpful methods:

TypeRef {
  typeName: string

  toType: member function() : Type
  fromType: function(inst: Type) : TypeRef
  fromString: function(name: string) : TypeRef
}
0 Likes