Tag Archives: build

Haxe: Running @:build macro on typedefs

As at 3.2.1, Haxe does not support @:build macros over a typedef. But I just discovered a trick to do that. That utilizes a @:genericBuild macro. Well, honestly, this is not truly a build macro because the type is read-only. i.e. you can’t add or remove or alter fields of the original type. But you can declare a new type based on that and return it as the type for the call site. I found it quite useful for my use case because I would like to make a copy of the typedef in some fashion.

Continue reading Haxe: Running @:build macro on typedefs