Closed
Description
π Search Terms
return, parens, parenthesis, assertion
π Version & Regression Information
- This is the behavior in every version I tried: v5.2.2, v5.3.2, v5.4.0-dev.20231129
β― Playground Link
π» Code
export class Foo {
client = {
getThing: () => Promise.resolve('')
}
foo(): Promise<void> {
return (
/* TODO: Avoid using type assertions, please refactor. */ this.client
.getThing() as unknown as Promise<void>
);
}
}
π Actual behavior
export class Foo {
constructor() {
this.client = {
getThing: () => Promise.resolve('')
};
}
foo() {
return
/* TODO: Avoid using type assertions, please refactor. */ this.client
.getThing();
}
}
This means new Foo().foo()
essentially returns undefined
.
π Expected behavior
foo() {
return (
/* TODO: Avoid using type assertions, please refactor. */ this.client
.getThing());
}
Additional information about the issue
This happens specifically when the return statement begins with a comment and ends with a type assertion.
Activity
nmain commentedon Nov 29, 2023
I congratulate you on inventing a brand new term (at least, I can't find any mention of it on Google anywhere), yet one that is immediately understandable to a reader who has never heard it before.
return
statement #60296