# Expansion issue in tasks package

I'm trying to switch from enumitem lists to tasks lists, but the following, which works in an ordinary enumerate environment, generates a "Something's wrong--perhaps a missing \item" error in the tasks environment:

\documentclass{article}
\newcommand{\itemexpansion}{\item test \item test \item test \item test}

\begin{document}
% OK
\begin{enumerate}
\itemexpansion
\end{enumerate}
% Error
\end{document}


I can tell that there's an expansion problem here, but that's about as far as my comprehension extends. It doesn't seem to match the situations warned about in the manual. Is there a workaround that will allow me to dump the results of a macro (the contents of which are gathered elsewhere) into a tasks environment?

tasks needs to explicitly see \task.

You can add a “command” form of tasks:

\documentclass{article}

\ExplSyntaxOn
{
\hagen_tasks:Vnn { #3 } { #1 } { #2 }
}
{
\tl_if_novalue:nTF { #3 }
{
}
{
}
}
\ExplSyntaxOff

\newcommand{\itemexpansion}{\item test \item test \item test \item test}

\begin{document}

\begin{enumerate}
\itemexpansion
\end{enumerate}

\end{document}


I create a new Tasks environment that calls upon tasks, while expanding the first argument (in this case, \taskexpansion).

\documentclass{article}
\newcommand{\itemexpansion}{\item test \item test \item test \item test}
\expandafter\expandafter\expandafter\tmp\BODY%