工业聚

Results 97 comments of 工业聚

从 runtime 机制上,可以有函数的版本,但写法会复杂一点。 从 type 层面,一旦涉及递归,目前的 TS,函数版本的 type infer 不奏效,TS 要求明确标注返回值。 class 版本,TS 有特殊处理,class 定义时,既包含 impl 实现,又包含 type 声明,可以支持递归关联。 函数版本,如果要保持 immutable,也很难实现递归引用。 总的来说,函数式的方式实现 farrow-module 可能是一个全新的思路和考量。现阶段还没有很清晰的想法。

Thx feedback, I will check it later:) ```typescript // for now, use `as` for workaround return Response.json({ code: 0, data: details, } as JsonType) ```

@sinoon @uinz Maybe we can file an issue for Typescript to see whether is a bug or not:-)

> Would this allow to use a typed API client on a frontend project that's separate from the backend? Yes, that is the goal. It will provide at least three...

Yes, the expected value of the JsonType is generally the plain javascript object/value, not the class instance If it is a class instance, it is expected to have a toJSON...

It seems easy to implement something like subscription via WebSocket or Polling in user-land. For now, I don't know much about what we need to support internally. If you already...

Yeah, I got it. If we want to use farrow-api via WebSocket, we need to add the codegen support in farrow-api. It may cause some degree of refactoring. It's not...

> Can there be a Subprogramme first? Such as a new package like farrow-subscription It's good, for the experiment.