Hey 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)

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mamot.fr/users/corpsmoderne/statuses/116096505907218381 on your instance and quote it. (Note that quoting is not supported in Mastodon.)