π Search Terms
2814, function body
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=4.4.4#code/MYGwhgzhAEBiD29oG9oChqegIzAJwEYAKAShWgF80q0AzAVwDtgAXAS3kbkVIG40A9AIB+APWgBRAEpSA8lIBccJqw5cA7mxYALHPAAmbAKYxgYLpxABPaAFsjeAOZHomndFCQIJ6DrAtofBcwW2xjRhYAOiA
π» Code
// tests/cases/compiler/callOverloads1.ts
class Foo {
bar1() { }
}
function Foo();
//~^ error report: Function with bodies can only merge with classes that are ambient.
π Actual behavior
The function Foo actually has no body (it's just a declaration), yet the error message says "Function with bodies...", which may be a bit confusing.
π Expected behavior
Either show a hint like "Only functions can merge with ambient classes," or suppress the error report for functions without a body because class Foo will report Class declaration cannot implement overload list for 'Foo'.
Additional information about the issue
No response
π Search Terms
2814, function body
π Version & Regression Information
v4.4.4.β― Playground Link
https://www.typescriptlang.org/play/?ts=4.4.4#code/MYGwhgzhAEBiD29oG9oChqegIzAJwEYAKAShWgF80q0AzAVwDtgAXAS3kbkVIG40A9AIB+APWgBRAEpSA8lIBccJqw5cA7mxYALHPAAmbAKYxgYLpxABPaAFsjeAOZHomndFCQIJ6DrAtofBcwW2xjRhYAOiA
π» Code
π Actual behavior
The
function Fooactually has no body (it's just a declaration), yet the error message says "Function with bodies...", which may be a bit confusing.π Expected behavior
Either show a hint like "Only functions can merge with ambient classes," or suppress the error report for functions without a body because
class Foowill reportClass declaration cannot implement overload list for 'Foo'.Additional information about the issue
No response