edgedb-js icon indicating copy to clipboard operation
edgedb-js copied to clipboard

"No function overload function" when user-defined scalar used as function parameter

Open hbriese opened this issue 1 year ago • 1 comments

Code The code causing the error.

e.greet(e.cast(e.Name, 'greg'));

Schema

module default {
  scalar type Name extending str {}

  function greet(name: Name) -> str using (
    "Hello, " ++ name ++ "!"
  );
}

Generated EdgeQL

Exception thrown

Error or desired behavior

No function overload found for 'e.default.greet()' with args: Element: default::Name (One)

Versions (please complete the following information):

  • OS:
  • EdgeDB version (e.g. 2.0): 4.5+28216a1"
  • EdgeDB CLI version (e.g. 2.0): 4.1.0+03ae624
  • edgedb-js version (e.g. 0.20.10;): 1.4.1
  • @edgedb/generate version (e.g. 0.0.7;): 0.4.1
  • TypeScript version: 5.3.3
  • Node/Deno version: 20.9.0

hbriese avatar Mar 07 '24 03:03 hbriese

The workaround is to accept a primative as the type param e.g. str and cast it to the desired type in the function

hbriese avatar Mar 07 '24 03:03 hbriese