I use titlesec to adjust chapter headings for the report class (no page breaks in main report, but with page breaks in appendix). However, cleveref now refers to the appendix as "chapter A" instead of "appendix A". Where am I making a mess of it?
MWE:
\documentclass{report}
\usepackage{etoolbox}
\usepackage{cleveref}
\usepackage{titlesec}
% No page break for chapters
\titleclass{\chapter}{straight}
\titleformat{\chapter}{\bfseries\huge}{\thechapter}{0.4em}{}
\titlespacing*{\chapter}{0mm}{4em}{1em}
% Page break for appendices
\makeatletter
\pretocmd{\appendix}{
\titleclass{\chapter}{top}
\titlespacing*{\chapter}{0mm}{-2em}{1em}
}
\makeatother
\begin{document}
\chapter{First chapter}
\label{sec:FirstChapter}
The appendix can be found in \cref{sec:FirstAppendix}.
\chapter{Second chapter}
\label{sec:SecondChapter}
\appendix
\chapter{First appendix}
\label{sec:FirstAppendix}
\end{document}
