This is not valid X++ code. Please give your actual code, so I don’t have to guess what’s a bug and what’s just caused by imprecise copying.
If you really try to use a constructor (new()), then it makes no sense and obviously can’t work. Use a method with the parameter type explained above.