#Ts-morph - New lining on constructur.addParameter()

3 messages · Page 1 of 1 (latest)

raw eagle
#

Hi all,

As anyone ever used ts-node/ts-morph. I'm trying to get my params to happen on new lines, but the life of me, no matter what I do. It seems to add them all to the same line.

This is the snippet of logic

  const paramsToAdd = [
    { name: 'route', type: 'ActivatedRoute' + '\n', scope: Scope.Protected },
    { name: 'location', type: 'Location' + '\n', scope: Scope.Protected },
    { name: 'routeService', type: 'RouteStateService' + '\n', scope: Scope.Protected },
  ];

  paramsToAdd.forEach(param => {
    if (!constructor.getParameter(param.name)) {
      constructor.addParameter(param);
    }
  });

I tried using a writer instead, didn't work

  paramsToAdd.forEach(param => {
    if (!constructor.getParameter(param.name)) {
      constructor.addParameter(writer => {
        writer.write(param + '\n');
      });
    }
  });

Any idea's would be greatly appreciated

sterile thicket
#

You try using writeLine?

raw eagle