Type.resolveClass returns null if class path string is typedef alias

Hello all,
I’m trying to instantiate object using Type.resolveClass but that class path is typedef alias for some other class.
So what I’m doing is:

  1. Have a config file where the class path is specified. Something like this:
    {
    “id”:“0”,
    “name”:“test_model”,
    “type”:“model”,
    “classPath”: “my.typedef.Alias”
    }

  2. Have a typedef like this ( which actually point to some other class ):

package my.typedef;

#if ( ubi_target_html && ubi_backend_vanilla && ubi_renderer_3D )
typedef Alias = udriver.assets.PCAsset;
#elseif ( ubi_target_html && ubi_backend_vanilla && ubi_renderer_2D )
typedef Alias = udriver.assets.PCAsset2D;
#end

  1. Then after loading and parsing json config from 1) I’m just passing the classpath ( my.typedef.Aliast ) to ‘Type.resolveClass’ but if returns null but if I pass the ‘original’ class path it works fine ( udriver.assets.PCAsset )

var a = parsed json config from 1)
assetObj = Type.createInstance( Type.resolveClass( a.classPath ), [ a, app ] );

Are there any limitations in Haxe which are preventing instantiation in this manner? If so, are there any workarounds?
I really need typedefs for this so I can have unique class name for different classes based on #if-s

Many thanks in advance,
Dinko

Typedefs don’t exist at run-time.

I’m afraid resolveClass needs the real (non aliased) classname so you’ll probably have to define your own class resolution, for instance based on a map ['my.typedef.Alias' => Alias].

Thanks Philippe!
I was afraid of that … back to drawing board.

D.