Can I inert inline `commentBlock` before an argument?

Author: cimakCreated Mar 5, 2026Updated Jun 27, 2026

I have:

typescript
f('foo');

and I want to insert inline block comment, like this:

typescript
f(/* comment */'foo');

Unfortunately, Im always getting newline between comment and argument:

typescript
// arg.comments = [ j.commentBlock(` comment `) ];
f(/* comment */
'foo');

// arg.comments = [ j.commentBlock(` comment `, true, false) ];
f(/* comment */
'foo');

// arg.comments = [ j.commentBlock(` comment `, false, true) ];
f('foo'/* comment */);

Any Ideas?

Playground: https://astexplorer.net/#/gist/efea82bb2a028629e17f70a97e43a355/9d951cc12f51086f315d6772443c603dfb020aa4

Transformer:

typescript
export default function transformer(file: FileInfo, api: API) {
    const j = api.jscodeshift
    const root = j(file.source);
    
    root
        .find(j.CallExpression, { callee: { type: "Identifier", name: "f" } })
        .forEach((path) => {
            const arg = path.node.arguments[0];
            arg.comments = [ j.commentBlock(` comment `) ];
        });


    return root.toSource({ quote: 'single' });
}