https://www.boundaryml.com logo
Hey everyone!
# contributing
p
Hey everyone! I think I’ve found a bug in the TypeScript client codegen. When a BAML function has a parameter named options, e.g.:
fn Foo(options: ConfigOptions) -> Bar
the generated TypeScript client creates a function like:
Copy code
async Foo(options: ConfigOptions, __baml_options__?) {
  const options = { ...this.bamlOptions, ...(__baml_options__ || {}) };
  ...
  this.runtime.callFunction("Foo", { options });
}
Because the parameter
options
and the internal variable
const options
use the same name, the parameter gets shadowed and the runtime receives the wrong value resulting in
[BAML ERROR]: Invalid parameters for BAML function Foo
It seems like other parameter names could also clash with internal locals (e.g. signal, collector, env, raw, etc.). Should I open a GitHub issue for this (didn't find anything similar)?
v
yes please do! we can patch this easily 🙂
we try and catch most of these and seems like we missed one!
we'll add a prefix for all internal generated ones!