Split Multi-Variable Declarations

Convert variable declarations with multiple variables into separate declarations that declare one variable each.

For example,

let a = 2, b;

is converted into

let a = 2;
let b;

Original Code

Changes

1const world: string = 'world',1const world: string = 'world';
2 p: number | undefined = 42;2const p: number | undefined = 42;
3 3
4console.log(`Hello, ${world}!`);4console.log(`Hello, ${world}!`);
1const world: string = 'world',
2 p: number | undefined = 42;
1const world: string = 'world';
2const p: number | undefined = 42;
33
44console.log(`Hello, ${world}!`);

Transformed Code

const world: string = 'world';
const p: number | undefined = 42;

console.log(`Hello, ${world}!`);

Explore More