You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript follows ES spec and per spec your second example is an arrow function where body is a function body wrapped in {} so val: 3 is interpreted as labelled statement with label val and expression statement with expression 3. In order to make it an arrow function that returns an object literal you'll need to wrap it in parens:
TypeScript Version: 2.0.3 / nightly (2.1.0-dev.201xxxxx)
Code
Expected behavior:
I expect it to compile fine.
fn_prim
should return 3 when called,fn_obj
should return{ val: 3 }
when called.Actual behavior:
"Unused label" error on
val:
The text was updated successfully, but these errors were encountered: