As you can see from the code, value is a Variant that contains a value. valueType seems to return Nil when value is not Nil. It doesn’t matter if value is a String or a Boolean, valueType still returns Nil. valueType is sometimes not Nil (for example if value is a JSONItem).
Am I (and the original author of the code) misunderstanding Introspection.GetType here?
What if value could be an intrinsic type or a class. How should I best elegantly handle that scenario? Should I do a Variant.Type check for a primitive and then fall through to TypeInfo?
It depends on how much information you need, but maybe something like this:
select case value.Type
case Variant.TypeString
// ...
case Variant.TypeBoolean
// ...
case Variant.TypeDate
var d as Date = value
// ...
case Variant.TypeDateTime
var dt as DateTime = value
// ...
case Variant.TypeObject
var ti as Introspection.TypeInfo = Introspection.GetType( value )
// ...