2.11.1

(fix): 当启用 oauth 时,_getAuthorizationHeader 方法现在返回 Promise<string | undefined>。 这可以防止 TypeScript SDK 中的编译错误。

2.11.0

(feat): 为具有 readonly 和/或 writeonly 属性的类型生成 RequestResponse 类型变体。 例如,类型 User 将拥有一个 User.Request 类型(省略 readonly 属性)和一个 User.Response 类型(省略 writeonly 属性)。

在生成器配置的 config 中将 experimentalGenerateReadWriteOnlyTypes 设置为 true 来启用此功能。

1import { User, FooClient } from "foo";
2
3const client = new FooClient(...);
4const createUser: User.Request = {
5 name: "Jon",
6 // id: "123", // Error: id is read-only and thus omitted
7};
8const createdUser: User.Response = await client.createUser(createUser);
9// createdUser.id is available here