Simplify code to generate type with fields string