Given a type, is there an API that tells me what type it extends?

#1

Type.mixins() gives me both mixin and extended types. How can I find out only the type that it extends? Is there an API for this?

0 Likes

#2
0 Likes

#3

better answer:

var extenders = _.filter(ATYPE.mixins(), function(mix) {return mix.isPersistable() && mix.typeName() != ‘Persistable’})

0 Likes

#4

Better-er answer:

var extenders = ATYPE.isEntity() ? _.filter(ATYPE.mixins(), function(mix) {
    return mix.isEntity();
}) : [];

Since a non-entity type may mixin entity types. (Example: canonical transform types mixin their transform target types, which should always be entity types)

And ATYPE.isEntity() is equivalent to ATYPE.isPersistable() && ATYPE.typeName() !== 'Persistable'

0 Likes