Hi Trent, you need to make use of the optional RETURNS clause of the FUNCTION typeBuilder
Also , since 4.1.x you don't need to return record.* anymore.
Just do this
FUNCTION typeBuilder(request STRING) RETURNS IType
DEFINE typeA TypeA, typeB TypeB
IF request = "typeA" THEN
RETURN typeA
ELSE
RETURN typeB
END IF
END FUNCTION
Regards , Leo