Fix function type so the function is optional, not the return value
Only add object type definition when there is no constructor