How can I use a Polymorphic Domain Object Container in a custom plugin extension?

BTW, you’ve probably already found this but…

PolymorphicDomainObjectContainer myContainer = project.getObjects().polymorphicDomainObjectContainer( MyContainedThings.class )
// register factories..

I still have not figured out how to actually use these things “properly” as they are documented in the guides for Gradle’s own PolymorphicDomainObjectContainer (tasks, etc). The syntax is supposed to be:

myContainer {
   standard {...}
   custom( CustomType ) {...}
}

For me, the custom( CustomType ) reference always fails - it tries to find a method named custom. Ugh