问题标签 [elmish]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
35 浏览

f# - 如何在 SAFE 堆栈中为 Thoth.Json 编写编码器/解码器?

我正在使用 SAFE 堆栈构建一个应用程序,并且我的模型中有一个 System.Uri。当我运行我的代码时,我在控制台中收到一个错误“无法为 System.Uri 生成自动编码器......”
到目前为止,我的谷歌搜索已经让我到了这里

然后在我的 App.fs 中添加

我想我已经了解如何创建编码器,但我不知道如何编写解码器部分。
我显然可以用字符串替换我的 System.Uri 字段,但这感觉不是正确的解决方案。