The typeid used in several functions of the AngelScript interface is a 32bit signed integer. Negative values are not valid typeids, and functions returning a typeid can thus use negative values to indicate errors.
The value contained in the typeid is composed to two parts, the lower bits indicated by asTYPEID_MASK_SEQNBR is a sequence that will increment with each new type registered by the application or declared in scripts. The higher bits form a bit mask indicating the category of the type. The bits in the bit mask have the following meaning:
To identify if a typeid is to a primitive check that the bits in asTYPEID_MASK_OBJECT are zero. This will be true for all built-in primitive types and for enums.
The built-in primitive types have pre-defined ids as seen in the enum asETypeIdFlags, and can be directly compared for their value, e.g. the typeid for a 32bit signed integer is asTYPEID_INT32.
To get further information about the type, e.g. the exact object type, then use asIScriptEngine::GetTypeInfoById which will return a asITypeInfo that can then be used to get all details about the type.