Illegal DEFtype statement after declaration
A Deftype statement is located in the wrong part of the module. Deftype statements must appear before all declarations (both explicit and implicit) in the module.
Move the Deftype statement so that it precedes the first declaration in the module.