TSRPC 3.2.0 版本更新

200 阅读1分钟

tsrpctsrpc-cli 迎来例行更新。

所有更新均向后兼容,您可以根据项目需要选择升级与否。

升级方式:

后端

npm i tsrpc@latest
npm i tsrpc-cli@latest -D

前端

npm i tsrpc-browser@latest
npm i tsrpc-miniapp@latest

更新内容

TSRPC 3.2.0

新特性

  • 支持 keyof 类型,现在可以正常解析 type A = keyof B
  • 支持在 Pick Omit 的第二个参数中使用 keyof 及引用类型
  • 支持在 PickOmit 的第一个参数中使用 Union Type 和 Intersection Type
  • 支持 interface 继承自 Pick Omit
  • 支持将字段类型设为枚举值,将被视为字面量
    export enum Types {
        Type1,
        Type2
    }
    export interface Obj {
        type: Types.Type1,
        value: string
    }
    

变更

  • SchemaType 由 enum 变为 class

tsrpc-cli 2.4.0

新特性

  • 支持新的 keyof 等类型生成

Bug 修复

  • 修复生成文档中,Pick Omit 的类型错误