extract isMacro helper in typer
add helper for expanding and replacing macros