add applyMacroWithType method
Add return type parameter to applyMacro