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
import{computed}from'vue';functiontakes(a: number): string{returna.toString();};constshouldFail=computed(takes);// works, should failconstfails=computed(()=>takes());// fails as it should
What is expected?
Typescript should fail to compile with the error "Expected x arguments, but got 0."
What is actually happening?
Typescript compiles the code without an error. Code crashes at runtime.
The problem is that ComputedGetter, which is the first argument to computed, has the type
You can pass the function as () => func() to ensure that if an argument is added to the function, typescript will tell you that it is missing, but that seems unnecessarily verbose.
The text was updated successfully, but these errors were encountered:
Version
3.2.31
Reproduction link
www.typescriptlang.org/play
Steps to reproduce
What is expected?
Typescript should fail to compile with the error "Expected x arguments, but got 0."
What is actually happening?
Typescript compiles the code without an error. Code crashes at runtime.
The problem is that ComputedGetter, which is the first argument to computed, has the type
while it should have the type
You can pass the function as
() => func()
to ensure that if an argument is added to the function, typescript will tell you that it is missing, but that seems unnecessarily verbose.The text was updated successfully, but these errors were encountered: