Typescriptでラムダ式を使う
概要
ラムダ式を利用して、配列的な値を返してあげたいときに以下のエラーが出たので対応方法をメモ&共有。
[ts] Unused label
解決策
以下のようなことをしたい。
const hoge = (aaa: any) => {bbb: aaa.ccc};
このときに戻り値を()で囲ってあげる必要があった。
const hoge = (aaa: any) => ({bbb: aaa.ccc});
ソース https://basarat.gitbooks.io/typescript/docs/arrow-functions.html
You can fix it by surrounding the object literal with ():