by benrbray · 5y ago · 0 comments
() => {
foo: "bar";
baz: "qux";
}
Thankfully TypeScript warns me it's a ()=>void function instead of whatever was expected in the context. I scratch my head for a while and then remember: () => ({
foo: "bar",
baz: "qux"
}); foo: "bar";
is a valid expression. I know, it's the named statement syntax normally used for loops, but I didn't know this worked for any expression."hi"; 1; true; new Date(); () => {};
This is valid JavaScript