環境
React-toolkit 1.4.0
原因
公式サイトに書いてあるけど、ReduxにSerializable不可能なclassを渡すと該当エラーが出る。
今回ひっかかった例だと他言語の感覚でclassをnewして渡すとNG。
いわゆるオブジェクトリテラル({}
)で表現できるものを渡さなければならないみたい。
OK
type A = {
member: string
}
const a: A = {member: 'member'};
NG
class A {
constructor(public member: string) {}
}
const a = new A("member");
参考
https://redux.js.org/style-guide/style-guide#do-not-put-non-serializable-values-in-state-or-actions