Open
Description
π Search Terms
isolatedDeclarations, autofixer, quick fix, quickfixer, quick-fix, duplicate, redundant, comments
π Version & Regression Information
TS5.5+
β― Playground Link
π» Code
export function f() {
const o = /** before */ { /* inline post-{ */ // end line post-{
// document first type
/* inline before */ x /* inline pre-colon */ : /* inline pre-type */ 5 /* inline post-type */ , // after comma1
// document second type
/** 2 before */ y : 'str' /** 2 after */, //after comma2
// pre-closing
} /** after */;
return o;
}
π Actual behavior
After running the autofixer, the result includes many of the inline code comments in the added type annotation. It looks like:
export function f(): { /* inline post-{ */ // end line post-{
// document first type
/* inline before */ x: number; /* inline post-type */ // after comma1
// document second type
/** 2 before */ y: string; /** 2 after */
} {
const o = /** before */ { /* inline post-{ */ // end line post-{
// document first type
/* inline before */ x /* inline pre-colon */ : /* inline pre-type */ 5 /* inline post-type */ , // after comma1
// document second type
/** 2 before */ y : 'str' /** 2 after */, //after comma2
// pre-closing
} /** after */;
return o;
}
π Expected behavior
The actual behavior isn't technically broken, but I would generally expect/prefer the generated annotation to include only types with no comments. Something like:
export function f(): {
x: number;
y: string;
} {
const o = /** before */ { /* inline post-{ */ // end line post-{
// document first type
/* inline before */ x /* inline pre-colon */ : /* inline pre-type */ 5 /* inline post-type */ , // after comma1
// document second type
/** 2 before */ y : 'str' /** 2 after */, //after comma2
// pre-closing
} /** after */;
return o;
}
Additional information about the issue
No response