Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Marc
Marc
@corpsmoderne@mamot.fr  ·  activity timestamp 3 hours ago

Hey #typescript people, is there a way to not declare a variable here and still specify the argument type on the call site?

what I have:

function foo(arg: Bar) { ... };

const arg : Bar = { ... };
foo(arg);

what I want:
foo({ ... } : Bar), // but that's not the syntax...

(note: that's typically a question LLM's are good at but I chose to value human interaction and not AI slop)

  • Copy link
  • Flag this post
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.29 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct