Improve error message when type is not declared as a <template>