Rhombus how to make a macro defining macro

I'm trying to figure out how I could write a macro datatype that creates an annotation macro so I could have code like:

typedef FuncArg: (Number || String)

10 :: FuncArg
"Hi" :: FuncArg

I'm new to Rhombus so I don't really know what I'm doing but I tried to create a macro that defines a macro like this

macro typedef '$name: $value':
  'annot.macro $name: $value'

typedef FuncArg: (Number || String)

but that didn't work and gives me the error macro: misuse as an expression in: macro

Also is there a good reference to learn macros in rhombus? I'm okay with scrolling through the code of project and using it as a references.

I got help on the Racket discord. If anyone else is trying to do this the following code works

#lang rhombus/static/and_meta

defn.macro 'typedef $name: $value':
  '«annot.macro '$name': '$value'»'

typedef NumStr: (Number || String)

fun test(a :: NumStr) :: NumStr:
  a

test(10)
test("b")
2 Likes