You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A class expression async method whose body returns a value is rejected because its return type is inferred as void. The equivalent class declaration infers the return correctly.
Reproduces in both the interpreter and compiled mode (it is a type-checker inference gap, so it is independent of back end).
The class-expression method path does not infer a method's return type from its body the way the class-declaration path does — it defaults to void, so any return <value> then fails TS2322.
A class expression async method whose body
returns a value is rejected because its return type is inferred asvoid. The equivalent class declaration infers the return correctly.Repro
Contrast — the class declaration form works (prints
5):Notes
void, so anyreturn <value>then fails TS2322.