Since both \@counteralias and cleveref's \@ynthm (when amsthm is loaded, see lines 2986--3024, especially line 3013) set \the<envname> globally, \thmt@autoreffix should also restore \the<envname> globally as well.
The difference is not sensible until package create-theorem uses \newtheorem in a group. Then the restoration in \thmt@autoreffix is cancelled after group.
Description
Since both
\@counteralias
andcleveref
's\@ynthm
(whenamsthm
is loaded, see lines 2986--3024, especially line 3013) set\the<envname>
globally,\thmt@autoreffix
should also restore\the<envname>
globally as well.The difference is not sensible until package
create-theorem
uses\newtheorem
in a group. Then the restoration in\thmt@autoreffix
is cancelled after group.Example and analysis
In example taken from https://tex.stackexchange.com/q/646129,
\CreateTheorem{theorem}{}
first expands to\crthm_create_theorem:nn{theorem}{}
, then callsThe remaining relevant stack trace looks like
Proposal