If you only need one extra field, you could write the template like this: 
    
    
    template typeGen(tName, name, kind: untyped): untyped =
      type
        tName {.inject.} = object
          fname: string
          age: int
          name: kind
    
    typeGen(Employee, id, int)
    

But rarely makes sense. If you have some idea in mind, we can come up with ways 
to macro/template it.

Reply via email to