I have a generic module MyModule.psm1 which creates and returns any custom type provided:
MyModule.psm1
function Create-CustomType { param ( [Param