// For direct class types:
class MaterialComponent {
@Optional(Rgb)
diffuseColor?: Rgb;
}
// For type aliases, use the base runtime class:
// type CollisionCallback = SerializableCallback<...>
class BoundingBoxComponent {
@Optional(SerializableCallback) // Use runtime class, not alias
onCollision?: CollisionCallback; // Type annotation can use alias
}
const material = new MaterialComponent();
getOptionalType(material, 'diffuseColor') // Returns Rgb
getOptionalType(material, 'onCollision') // Returns SerializableCallback
The runtime class/constructor that represents the property's type. For type aliases, use the base runtime class they resolve to.